search for: valid_find_opt

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

2007 Dec 09
0
straight join in rails
...uch work too, so I decided to take a shorter route: intercept the 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 e...