Module: ActiveRecord::TypedStore::Behavior::ClassMethods
- Defined in:
- lib/active_record/typed_store/behavior.rb
Instance Method Summary collapse
- #define_attribute_methods ⇒ Object
- #define_typed_store_attribute_methods ⇒ Object
-
#undefine_attribute_methods ⇒ Object
:nodoc:.
- #undefine_before_type_cast_method(attribute) ⇒ Object
Instance Method Details
#define_attribute_methods ⇒ Object
8 9 10 11 |
# File 'lib/active_record/typed_store/behavior.rb', line 8 def define_attribute_methods super define_typed_store_attribute_methods end |
#define_typed_store_attribute_methods ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/active_record/typed_store/behavior.rb', line 18 def define_typed_store_attribute_methods return if @typed_store_attribute_methods_generated store_accessors.each do |attribute| define_attribute_method(attribute) undefine_before_type_cast_method(attribute) end @typed_store_attribute_methods_generated = true end |
#undefine_attribute_methods ⇒ Object
:nodoc:
13 14 15 16 |
# File 'lib/active_record/typed_store/behavior.rb', line 13 def undefine_attribute_methods # :nodoc: super if @typed_store_attribute_methods_generated @typed_store_attribute_methods_generated = false end |
#undefine_before_type_cast_method(attribute) ⇒ Object
27 28 29 30 31 |
# File 'lib/active_record/typed_store/behavior.rb', line 27 def undefine_before_type_cast_method(attribute) # because it mess with ActionView forms, see #14. method = "#{attribute}_before_type_cast" undef_method(method) if method_defined?(method) end |