Class: WeThePeople::AssociationProxy
- Inherits:
-
Object
- Object
- WeThePeople::AssociationProxy
- Defined in:
- lib/we_the_people/association_proxy.rb
Instance Method Summary collapse
- #all ⇒ Object
- #cursor(criteria = {}) ⇒ Object
- #find(id) ⇒ Object
- #first ⇒ Object
- #get_all ⇒ Object
-
#initialize(parent, klass) ⇒ AssociationProxy
constructor
A new instance of AssociationProxy.
- #length ⇒ Object
Constructor Details
#initialize(parent, klass) ⇒ AssociationProxy
Returns a new instance of AssociationProxy.
3 4 5 6 |
# File 'lib/we_the_people/association_proxy.rb', line 3 def initialize(parent, klass) @klass = klass @parent = parent end |
Instance Method Details
#all ⇒ Object
20 21 22 |
# File 'lib/we_the_people/association_proxy.rb', line 20 def all cursor.all end |
#cursor(criteria = {}) ⇒ Object
12 13 14 |
# File 'lib/we_the_people/association_proxy.rb', line 12 def cursor(criteria = {}) @cursor ||= @klass.cursor(@parent, criteria) end |
#find(id) ⇒ Object
8 9 10 |
# File 'lib/we_the_people/association_proxy.rb', line 8 def find(id) @klass.find(id, @parent) end |
#first ⇒ Object
28 29 30 |
# File 'lib/we_the_people/association_proxy.rb', line 28 def first cursor.first end |
#get_all ⇒ Object
16 17 18 |
# File 'lib/we_the_people/association_proxy.rb', line 16 def get_all cursor.get_all(false) end |
#length ⇒ Object
24 25 26 |
# File 'lib/we_the_people/association_proxy.rb', line 24 def length cursor.length end |