Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# 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 } named_scope :has_moo_and_foo, lambda { has_moo.has_foo.scope(:find) } #^^ we need scope(:find) at the end as return value can only be a Hash - how creat would this be if we can return a scope object as well?? end # -> now this works: # Fu.has_moo_and_foo.all # Sweet!
This paste will be private.
From the Design Piracy series on my blog: