Skip to content

Instantly share code, notes, and snippets.

@clamstew
Created October 28, 2013 16:25
Show Gist options
  • Save clamstew/7199992 to your computer and use it in GitHub Desktop.
Save clamstew/7199992 to your computer and use it in GitHub Desktop.
Using staby lambda to put scope on the model
class Task < ActiveRecord::Base
belongs_to :project
belongs_to :employee
scope :complete, ->{ where(complete: true) }
scope :incomplete, ->{ where(complete: false) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment