Module: Highrise::Searchable::ClassMethods
- Defined in:
- lib/highrise/searchable.rb
Instance Method Summary collapse
-
#search(options = {}) ⇒ Object
List By Search Criteria Ex: Highrise::Person.search(:email => “[email protected]”, :country => “CA”) Available criteria are: city, state, country, zip, phone, email.
Instance Method Details
#search(options = {}) ⇒ Object
List By Search Criteria Ex: Highrise::Person.search(:email => “[email protected]”, :country => “CA”) Available criteria are: city, state, country, zip, phone, email
11 12 13 14 15 16 17 18 19 |
# File 'lib/highrise/searchable.rb', line 11 def search( = {}) search_params = .inject({}) { |h, (k, v)| h["criteria[#{k}]"] = v; h } # This might have to be changed in the future if other non-pagable resources become searchable if self.respond_to?(:find_all_across_pages) self.find_all_across_pages(:from => "/#{self.collection_name}/search.xml", :params => search_params) else self.find(:all, {:from => "/#{self.collection_name}/search.xml", :params => search_params}) end end |