Created
March 6, 2012 21:21
-
-
Save adamkirkwood/1989034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Attach the scope as part of a chain in an ActiveRecord query: | |
UserFacebookFanpages.valid.tracked.find(:all) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserFacebookFanpages < ActiveRecord::Base | |
# ... | |
# Scopes | |
scope :valid, where("is_invalid != null OR is_invalid != 0") | |
scope :invalid, where(:is_invalid => true) | |
scope :tracked, where(:is_tracked => true) | |
scope :not_tracked, where(:is_tracked => false) | |
#... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment