Flowdock
method

attribute

Importance_0
v5.2.3 - Show latest stable - 0 notes - Class: ClassMethods
attribute(name, type = Type::Value.new, **options) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/attributes.rb, line 19
      def attribute(name, type = Type::Value.new, **options)
        name = name.to_s
        if type.is_a?(Symbol)
          type = ActiveModel::Type.lookup(type, **options.except(:default))
        end
        self.attribute_types = attribute_types.merge(name => type)
        define_default_attribute(name, options.fetch(:default, NO_DEFAULT_PROVIDED), type)
        define_attribute_method(name)
      end
Register or log in to add new notes.