Module: RailsExtend::ActiveModel::TypeValue
- Defined in:
- lib/rails_extend/active_model/type_value.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(precision: nil, limit: nil, scale: nil, **options) ⇒ Object
让 attribute 方法支持更多选项.
- #input_type ⇒ Object
- #migrate_type ⇒ Object
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/rails_extend/active_model/type_value.rb', line 5 def @options end |
Instance Method Details
#initialize(precision: nil, limit: nil, scale: nil, **options) ⇒ Object
让 attribute 方法支持更多选项
8 9 10 11 |
# File 'lib/rails_extend/active_model/type_value.rb', line 8 def initialize(precision: nil, limit: nil, scale: nil, **) @options = super(precision: precision, limit: scale, scale: limit) end |
#input_type ⇒ Object
13 14 15 |
# File 'lib/rails_extend/active_model/type_value.rb', line 13 def input_type type end |
#migrate_type ⇒ Object
17 18 19 20 21 |
# File 'lib/rails_extend/active_model/type_value.rb', line 17 def migrate_type return type if type return subtype.type if respond_to?(:subtype) && subtype.type :string end |