Namespace
Methods
A
B
C
D
I
P
S
T
Included Modules
Class Public methods
attribute_names()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 20
def self.attribute_names
  %w{ one two three }
end
base_class()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 14
def self.base_class; self; end
columns()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 27
def self.columns
  attribute_names.map { FakeColumn.new(name) }
end
columns_hash()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 31
def self.columns_hash
  Hash[attribute_names.map { |name|
    [name, FakeColumn.new(name)]
  }]
end
decorate_matching_attribute_types(*)
# File activerecord/test/cases/attribute_methods/read_test.rb, line 15
def self.decorate_matching_attribute_types(*); end
initialize_generated_modules()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 16
def self.initialize_generated_modules; end
primary_key()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 24
def self.primary_key
end
superclass()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 13
def self.superclass; Base; end
Instance Public methods
setup()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 11
def setup
  @klass = Class.new do
    def self.superclass; Base; end
    def self.base_class; self; end
    def self.decorate_matching_attribute_types(*); end
    def self.initialize_generated_modules; end

    include ActiveRecord::AttributeMethods

    def self.attribute_names
      %w{ one two three }
    end

    def self.primary_key
    end

    def self.columns
      attribute_names.map { FakeColumn.new(name) }
    end

    def self.columns_hash
      Hash[attribute_names.map { |name|
        [name, FakeColumn.new(name)]
      }]
    end
  end
end
test_attribute_methods_generated?()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 53
def test_attribute_methods_generated?
  assert_not @klass.method_defined?(:one)
  @klass.define_attribute_methods
  assert @klass.method_defined?(:one)
end
test_define_attribute_methods()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 39
def test_define_attribute_methods
  instance = @klass.new

  @klass.attribute_names.each do |name|
    assert !instance.methods.map(&:to_s).include?(name)
  end

  @klass.define_attribute_methods

  @klass.attribute_names.each do |name|
    assert instance.methods.map(&:to_s).include?(name), "#{name} is not defined"
  end
end