Namespace
Methods
B
C
D
P
S
T
Included Modules
Class Public methods
base_class()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 19
def self.base_class; self; end
column_names()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 30
def self.column_names
  %w{ one two three }
end
columns()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 37
def self.columns
  column_names.map { FakeColumn.new(name) }
end
columns_hash()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 41
def self.columns_hash
  Hash[column_names.map { |name|
    [name, FakeColumn.new(name)]
  }]
end
define_attribute_methods()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 23
def self.define_attribute_methods
  # Created in the inherited/included hook for "proper" ARs
  @attribute_methods_mutex ||= Mutex.new

  super
end
primary_key()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 34
def self.primary_key
end
superclass()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 18
def self.superclass; Base; end
Instance Public methods
setup()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 16
def setup
  @klass = Class.new do
    def self.superclass; Base; end
    def self.base_class; self; end

    include ActiveRecord::AttributeMethods

    def self.define_attribute_methods
      # Created in the inherited/included hook for "proper" ARs
      @attribute_methods_mutex ||= Mutex.new

      super
    end

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

    def self.primary_key
    end

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

    def self.columns_hash
      Hash[column_names.map { |name|
        [name, FakeColumn.new(name)]
      }]
    end
  end
end
test_attribute_methods_generated?()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 63
def test_attribute_methods_generated?
  assert(!@klass.attribute_methods_generated?, 'attribute_methods_generated?')
  @klass.define_attribute_methods
  assert(@klass.attribute_methods_generated?, 'attribute_methods_generated?')
end
test_define_attribute_methods()
# File activerecord/test/cases/attribute_methods/read_test.rb, line 49
def test_define_attribute_methods
  instance = @klass.new

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

  @klass.define_attribute_methods

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