Module: ActiveModel::Associations::OverrideMethods
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveModel::Associations
- Defined in:
- lib/active_model/associations/override_methods.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#association(name) ⇒ Object
use by association accessor.
-
#new_record? ⇒ Boolean
dummy.
- #read_attribute(name) ⇒ Object (also: #_read_attribute)
Instance Method Details
#association(name) ⇒ Object
use by association accessor
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/active_model/associations/override_methods.rb', line 64 def association(name) #:nodoc: association = association_instance_get(name) if association.nil? reflection = self.class.reflect_on_association(name) if reflection.[:active_model] association = ActiveRecord::Associations::HasManyForActiveModelAssociation.new(self, reflection) else association = reflection.association_class.new(self, reflection) end association_instance_set(name, association) end association end |
#new_record? ⇒ Boolean
dummy
86 87 88 |
# File 'lib/active_model/associations/override_methods.rb', line 86 def new_record? false end |
#read_attribute(name) ⇒ Object Also known as: _read_attribute
80 81 82 |
# File 'lib/active_model/associations/override_methods.rb', line 80 def read_attribute(name) send(name) end |