Skip to content

Instantly share code, notes, and snippets.

@dangalipo
Created June 30, 2011 03:35
Show Gist options
  • Select an option

  • Save dangalipo/1055579 to your computer and use it in GitHub Desktop.

Select an option

Save dangalipo/1055579 to your computer and use it in GitHub Desktop.
def self.premium_hotels
where(:premium => true)
end
#is the same as
scope :premium_hotels, where(:premium => true)
#similarly
def self.rating_descending
order("rating DESC")
end
# is the same as
scope :rating_descending, order("rating DESC")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment