Class: DataMapper::CollectionReference
- Inherits:
-
Associations::OneToMany::Relationship
- Object
- Associations::OneToMany::Relationship
- DataMapper::CollectionReference
- Defined in:
- lib/dm-ssbe-adapter/model_extensions.rb
Instance Method Summary collapse
-
#query_for(source, other_query = nil) ⇒ Object
NOTE: This is why asserting valid options is a retarded idea.
- #reference_property ⇒ Object
- #source_scope(source) ⇒ Object
Instance Method Details
#query_for(source, other_query = nil) ⇒ Object
NOTE: This is why asserting valid options is a retarded idea. It makes it a giant pain in the ass to extend anything. I want a :location option on query. I have to have to extend every instance of a query, and set the location manually. The single commented line in ‘#source_scope` would be all thats needed, otherwise.
62 63 64 65 66 67 |
# File 'lib/dm-ssbe-adapter/model_extensions.rb', line 62 def query_for(source, other_query = nil) query = super query.extend(SsbeQueryExtensions) query.location = reference_property.get(source) query end |
#reference_property ⇒ Object
74 75 76 77 78 |
# File 'lib/dm-ssbe-adapter/model_extensions.rb', line 74 def reference_property property_name = "#{name}_href".to_sym parent_model.properties(parent_repository_name)[property_name] end |
#source_scope(source) ⇒ Object
69 70 71 72 |
# File 'lib/dm-ssbe-adapter/model_extensions.rb', line 69 def source_scope(source) #{:location => child_key.get(source)} {} end |