Method: Point::Base.find
- Defined in:
- lib/point/base.rb
.find(type, params = {}) ⇒ Object
Find a record or set of records. Passing :all will return all records and passing an integer will return the individual record for the ID passed.
24 25 26 27 28 29 30 31 |
# File 'lib/point/base.rb', line 24 def find(type, params = {}) case type when :all then find_all(params) when Integer then find_single(type, params) when String then find_all(params).select {|r| r.attributes["name"] == type}.first else raise Point::Error, "Find requires :all, a string or an integer." end end |