Skip to content

Instantly share code, notes, and snippets.

@mildfuzz
Created November 30, 2012 09:56
Show Gist options
  • Select an option

  • Save mildfuzz/4174872 to your computer and use it in GitHub Desktop.

Select an option

Save mildfuzz/4174872 to your computer and use it in GitHub Desktop.
Example Rails 3 Scopes for reference
scope :scope, where("column=value")
scope :scope_with_input, lambda { |value| where("column =?", value)}
scope :cope_with_join_and_input, lambda { |value| joins(:other_table).where("other_table.other_table_column =?", value)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment