module ActiveModel::Attributes::ClassMethods
def attribute(name, ...)
person.name # => "Volmer"
person.name = "Volmer"
person = Person.new
end
attribute :active, :boolean, default: true
attribute :name, :string
include ActiveModel::Attributes
class Person
supported by the given cast type.
type and default value may be specified, as well as any options
Defines a model attribute. In addition to the attribute name, a cast
:call-seq: attribute(name, cast_type = nil, default: nil, **options)
#
def attribute(name, ...) super define_attribute_method(name) end