Created
November 24, 2010 23:19
-
-
Save joeljunstrom/714619 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
class Account < ActiveRecord::Base | |
scope :scope1, where("domain in('bit', 'bite')") | |
scope :scope2, where("custom_domain = 'bites'") | |
end | |
>> Account.scope1.scope2.to_sql | |
=> "SELECT \"accounts\".* FROM \"accounts\" WHERE (domain in('bit', 'bite')) AND (custom_domain = 'bites')" | |
>> Account.scope2.scope1.to_sql | |
=> "SELECT \"accounts\".* FROM \"accounts\" WHERE (custom_domain = 'bites') AND (domain in('bit', 'bite'))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment