Class: UuidAssociations::ActiveRecord::RelationshipDefinitions::Base
- Inherits:
-
Object
- Object
- UuidAssociations::ActiveRecord::RelationshipDefinitions::Base
- Defined in:
- lib/uuid_associations/active_record/relationship_definitions/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(klass, payload, name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(klass, payload, name) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 |
# File 'lib/uuid_associations/active_record/relationship_definitions/base.rb', line 11 def initialize(klass, payload, name) @klass = klass @payload = payload @name = name.to_s end |
Class Method Details
.define_accesors_for(klass, payload, name) ⇒ Object
7 8 9 |
# File 'lib/uuid_associations/active_record/relationship_definitions/base.rb', line 7 def self.define_accesors_for(klass, payload, name) new(klass, payload, name).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/uuid_associations/active_record/relationship_definitions/base.rb', line 17 def call reflection = find_reflection(payload) association_class_name = class_name_from_reflection(reflection) return payload if association_class_name.nil? define_accesors(klass, association_class_name) if uuid_column?(association_class_name) payload end |