Skip to content

Instantly share code, notes, and snippets.

@nicolasblanco
Created August 6, 2009 14:58
Show Gist options
  • Save nicolasblanco/163362 to your computer and use it in GitHub Desktop.
Save nicolasblanco/163362 to your computer and use it in GitHub Desktop.
class Address < ActiveRecord::Base
named_scope :primary, :conditions => { :primary => true }
named_scope :not_primary, :conditions => { :primary => false }
end
>> a = Address.primary.new
=> #<Address id: nil, address: nil, zip_code: nil, city: nil, primary: true, group_id: nil, user_id: nil, country_id: nil, created_at: nil, updated_at: nil>
>> a = Address.not_primary.new
=> #<Address id: nil, address: nil, zip_code: nil, city: nil, primary: false, group_id: nil, user_id: nil, country_id: nil, created_at: nil, updated_at: nil>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment