search for: orig_add_join

Displaying 1 result from an estimated 1 matches for "orig_add_join".

Did you mean: orig_add_joins
2007 Dec 09
0
straight join in rails
...e generated sql query, and replace SELECT with SELECT STRAIGHT_JOIN. Here''s a monkey-patch (written against ActiveRecord 1.5.14) that achieves this behaviour: module ActiveRecord class Base class << self VALID_FIND_OPTIONS << :straight_join alias_method :orig_add_joins!, :add_joins! def add_joins!(sql, options, scope = :auto) orig_add_joins!(sql,options,scope) sql.gsub!(/^SELECT/,''SELECT STRAIGHT_JOIN'') if options[:straight_join] end end end end So simply supply a :straight_join => true option to find...