Class: Spyke::Associations::HasOne
- Inherits:
-
Association
- Object
- Relation
- Association
- Spyke::Associations::HasOne
- Defined in:
- lib/spyke/associations/has_one.rb
Instance Attribute Summary
Attributes inherited from Association
Attributes inherited from Relation
Instance Method Summary collapse
-
#initialize(*args) ⇒ HasOne
constructor
A new instance of HasOne.
Methods inherited from Association
#assign_nested_attributes, #create, #load, #new
Methods inherited from Relation
#each, #find, #find_one, #find_some, #uri, #where, #with, #with_fallback
Constructor Details
#initialize(*args) ⇒ HasOne
Returns a new instance of HasOne.
4 5 6 7 8 |
# File 'lib/spyke/associations/has_one.rb', line 4 def initialize(*args) super @options.reverse_merge!(uri: "#{parent.class.model_name.plural}/:#{foreign_key}/#{@name}") @params[foreign_key] = parent.id end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spyke::Relation