Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def self.find_with_fuzzy_keywords(attrs={}) attrs.reject! &:blank? attrs[:keywords] = [] || attrs[:keywords].collect { |word| "%#{word}%" } condition_string = ( attrs.except(:keywords).collect { |key,value| "#{key} = ?" } + attrs[:keywords].collect { |key,value| "#{key} LIKE ?" } ).join(" AND ") find( :all, :conditions => attrs.collect { |key,value| value }.unshift(condition_string) ) end
This paste will be private.
From the Design Piracy series on my blog: