Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ever had the trouble to create a new named_scope out of others? See how it works:
- class Fu < ActiveRecord::Base
- named_scope :has_moo, :conditions => { :moo => true }
- named_scope :has_foo, :conditions => { :foo => true }
- def has_moo_and_foo
- has_moo.has_foo
- end
- end
- # -> now this works:
- # Fu.has_moo_and_foo.all
- # Sweet!
Add Comment
Please, Sign In to add comment