class WiseGopher::UndeclaredColumns

raised when result contains more columns than declared

Attributes

column_names[R]

Public Class Methods

new(column_names) click to toggle source
# File lib/wise_gopher/errors.rb, line 32
def initialize(column_names)
  @column_names = column_names.map do |name|
    "- \"#{name}\""
  end.join("\n")
end

Public Instance Methods

message() click to toggle source
# File lib/wise_gopher/errors.rb, line 38
    def message
      <<~STR
        \n
        The following columns where found in result but were not declared:
        #{column_names}

        If you need them during query execution but not in result,
        you should ignore them, like this:

        class Query < WiseGopher::Base
          query "SELECT title, rating FROM articles"

          row do
            column :title, :string
            ignore :rating
          end
        end
      STR
    end