Created
April 8, 2009 20:06
-
-
Save javan/91970 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 User < ActiveRecord::Base | |
# These are all boolean fields defined for this User model. | |
# As we add more email columns, and add them to this array, | |
# the named_scope below keeps up. | |
EMAIL_COLUMNS = [:email_new_market_alerts, :email_new_announcements, :email_stock_notices] | |
named_scope :unsubscribed, lambda { { :conditions => EMAIL_COLUMNS.inject({}) { |conditions, column| conditions[column] = false; conditions } } } | |
end | |
# Find everyone who doesn't want any of our emails | |
User.unsubscribed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment