= supernova == Setup will come back soon! === Anonymous Scopes scope = Offer.order("popularity desc").with(:city => "Hamburg").paginate(:page => 2, :per_page => 10) # no query sent yet # query is sent e.g. when scope.each { |offer| puts offer.city } # objects of current page are iterated scope.total_entries # no objects loaded though scope.ids # no objects loaded, only ids are returned scope.first or scope.last # all objects are loaded, only first or last in "page" is returned === Named Scopes class Offer named_search_scope :popular do order("popularity desc") end named_search_scope :for_artists do |ids| with(:artist_id => ids) end end Offer.popular.for_artists([1, 2, 3]) # various named scopes can be combined Offer.popular.for_artists([1, 2, 3]).with(:available => true) # named scopes can also be combined with anonymous scopes === Geo Searches Offer.search_scope.near(47.0, 11.0).within(1.kms) Offer.search_scope.near(47.0, 11.0).within(100.meters) Offer.search_scope.near(other_offer).within(100.meters) == Contributing to search_scopes * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it * Fork the project * Start a feature/bugfix branch * Commit and push until you are happy with your contribution * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. == Copyright Copyright (c) 2011 Dynport GmbH. See LICENSE.txt for further details.