Class: ActiveResource::WhereClause
- Inherits:
- BasicObject
- Defined in:
- lib/active_resource/where_clause.rb
Overview
:nodoc:
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
-
#initialize(resource_class, options = {}) ⇒ WhereClause
constructor
A new instance of WhereClause.
- #load ⇒ Object
- #reload ⇒ Object
- #where(clauses = {}) ⇒ Object
Constructor Details
#initialize(resource_class, options = {}) ⇒ WhereClause
Returns a new instance of WhereClause.
7 8 9 10 11 12 |
# File 'lib/active_resource/where_clause.rb', line 7 def initialize(resource_class, = {}) @resource_class = resource_class = @resources = nil @loaded = false end |
Instance Method Details
#all(options = {}) ⇒ Object
18 19 20 |
# File 'lib/active_resource/where_clause.rb', line 18 def all( = {}) WhereClause.new(@resource_class, .deep_merge()) end |
#load ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/active_resource/where_clause.rb', line 22 def load unless @loaded @resources = @resource_class.find(:all, ) @loaded = true end self end |
#reload ⇒ Object
31 32 33 34 |
# File 'lib/active_resource/where_clause.rb', line 31 def reload reset load end |
#where(clauses = {}) ⇒ Object
14 15 16 |
# File 'lib/active_resource/where_clause.rb', line 14 def where(clauses = {}) all(params: clauses) end |