avatar

29

Added :additional option to find_with, allowing more sql terms to be tagged on

by abloke, 02 Feb, 2007 04:19 PM
26 29  
1616 0.3.2 - 01-02-2007
1717 * Refactored the find_with method, and added IN [2,1,6] capability
1818 
19 0.3.3 - 01-02-2007
20 * Added operators AND and OR for find conditionals
19 0.3.3 - 02-02-2007
20 * Added operators AND and OR for find conditionals
21 
22 0.3.3 - 02-02-2007
23 * Added :additional option to find_with, allowing more sql terms to be tagged on
28 29  
4444   def self.find_with(options={})
4545     limit = (options.delete(:limit) || 10)
4646     order = options.delete(:order)
47     if options[:additional]
48       additionals = options[:additional].is_a?Array ? options[:additional] : [options[:additional]]
49     end
50     options.delete(:additional)
4751     conditions = self.build_sql_conditional_for(options)
52     conditions << (conditions ? " AND " : "") << options[:additional].join(" #{operator || "AND"} ") if options[:additional]
4853     self.find(:all, :conditions => conditions, :limit => limit, :order => order)
4954   end
5055