Skip to content

Instantly share code, notes, and snippets.

@ecin
Created July 10, 2011 07:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ecin/1074354 to your computer and use it in GitHub Desktop.
Save ecin/1074354 to your computer and use it in GitHub Desktop.
class Address
# :street, String
# :city, String
# :state, String
# :country, String
scope :local, lambda { |query| search_by_street_or_city(query, query) }
scope :national, lambda {|query| search_by_state_or_country(query, query) }
end
Address.national("Iceland") # => [<Address ...>]
Address.local("Iceland") # => []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment