Class: NaranyaEcm::Rest::AssociationRelation
- Defined in:
- lib/naranya_ecm/rest/association_relation.rb
Instance Attribute Summary collapse
-
#foreign_key_name ⇒ Object
readonly
Returns the value of attribute foreign_key_name.
-
#foreign_key_value ⇒ Object
readonly
Returns the value of attribute foreign_key_value.
Attributes inherited from Relation
#conditions, #elements, #klass
Instance Method Summary collapse
- #fetch_from_server ⇒ Object
-
#initialize(given_klass, given_foreign_key_name, given_foreign_key_value) ⇒ AssociationRelation
constructor
A new instance of AssociationRelation.
Methods inherited from Relation
#[], #limit, #load, #to_a, #where
Constructor Details
#initialize(given_klass, given_foreign_key_name, given_foreign_key_value) ⇒ AssociationRelation
Returns a new instance of AssociationRelation.
8 9 10 11 12 13 14 15 16 |
# File 'lib/naranya_ecm/rest/association_relation.rb', line 8 def initialize(given_klass, given_foreign_key_name, given_foreign_key_value) raise ArgumentError unless given_foreign_key_name.present? @foreign_key_name, @foreign_key_value = given_foreign_key_name, given_foreign_key_value super(given_klass, foreign_key_name => foreign_key_value) end |
Instance Attribute Details
#foreign_key_name ⇒ Object (readonly)
Returns the value of attribute foreign_key_name.
6 7 8 |
# File 'lib/naranya_ecm/rest/association_relation.rb', line 6 def foreign_key_name @foreign_key_name end |
#foreign_key_value ⇒ Object (readonly)
Returns the value of attribute foreign_key_value.
6 7 8 |
# File 'lib/naranya_ecm/rest/association_relation.rb', line 6 def foreign_key_value @foreign_key_value end |
Instance Method Details
#fetch_from_server ⇒ Object
18 19 20 |
# File 'lib/naranya_ecm/rest/association_relation.rb', line 18 def fetch_from_server foreign_key_value.present? ? super : [] end |