Oh, too bad. It does not work in conjunction with apply_scopes(:search=>@search). It generates a leading group of parentheses ... so the where statement looks like "where ((())) and (...)".
On Mar 17, 1:01 pm, Tuishimi <[email protected]> wrote: > Hi Matt! This is working great for me, except for one thing, it does > not like the actual current table/name. So it handles the associated > tables well, but if I use it for the current table it fails. Should I > ONLY use it for associated tables and then use "apply_scopes" for the > rest? > > Thank you! > > Mike > > On Mar 16, 2:06 pm, Matt Jones <[email protected]> wrote: > > > > > On Mar 16, 2011, at 4:56 PM, Tuishimi wrote: > > > > I am taking advantage of a relationship, so my lookup rolls like this: > > > > Where ClassA has a has_many :ClassB... > > > > @class_a = ClassA.find(key) > > > @class_bs = @class_a.class_bs.apply_scopes( > > > :search => [params[:search], :id, :x_id, > > > 'xxxxxxxxxx_types.name'], > > > :order_by => @order > > > ).paginate(...) > > > > Does this help at all? During the display process, rails/hobo > > > performs additional look ups to process fields="xxxxxxxxxx_type.name", > > > for example. > > > On digging a little more, it looks like you only get automatic include > > behavior if you're sorting on a belongs_to (a feature I forgot existed): > > > parse_sort_param('user',...) > > > The code that I'm using those scopes in does an explicit :include => > > [:user, ...] to make sure the required tables are involved. This is useful > > as well, as the code won't need to execute additional DB queries to display > > data from the associated records. > > > Sorry for the confusion! > > > --Matt Jones- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
