Got it all working... I can sort using apply_scopes, I can search
everything in my table and associated tables...

Can I just say that I love you, Matt?

On Mar 17, 1:18 pm, Tuishimi <[email protected]> wrote:
> Looked like that was a typo?  So I changed the code to be
> #[email protected]_name} but now I am getting this error:
>
> undefined method `table_name' for nil:NilClass... it doesn't like
> @klass...?
>
> Sorry to be a pain.  But this is like... the holy grail of
> searchability, if it works!
>
> On Mar 17, 1:02 pm, Tuishimi <[email protected]> wrote:
>
>
>
> > This is what I am seeing in the query, by the way, when I search on a
> > field that is part of the main table (called "notes").
>
> > (#[email protected]_name}.notes
>
> > 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 -- 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.

Reply via email to