module ActiveFedora::AttributeMethods
def [](attr_name)
person[:name] # => ActiveModel::MissingAttributeError: missing attribute: name
person = Person.select('id').first
person[:age] # => 22
person[:name] # => "Francesco"
person = Person.new(name: 'Francesco', age: '22')
end
belongs_to :organization
class Person < ActiveRecord::Base
Alias for the read_attribute method.
ActiveModel::MissingAttributeError if the identified attribute is missing.
"2004-12-12" in a date column is cast to a date object, like Date.new(2004, 12, 12)). It raises
Returns the value of the attribute identified by attr_name after it has been typecast (for example,
def [](attr_name) read_attribute(attr_name) { |n| missing_attribute(n, caller) } end