On Jul 28, 2011, at 10:58 AM, Bob Sleys wrote:

> OK you've convinced me :)
> 
> However I'm now running into another problem getting it setup.
> 
> I got my link to point to the spaces for floor index page.  I added the basic 
> table_plus tag to the views/spaces/index_for_floor.dryml
> <index-for-floor-page>
>   <collection: replace>
>     <div>
>       <table-plus fields="name, space_dwgid"/>
>     </div>
>   </collection:>
> </index-for-floor-page>
> It works fine until I try to add the sorting/searching to the spaces 
> controller
> 
>    def index_for_floor
>     params[:sort] ||= "name"
>     hobo_index_for :floor, Space.apply_scopes(:search => 
> [params[:search],:name] )
>   end
> 
> I got the following error message once I add the Space.apply_scopes.
> undefined method `editable_by?' for #<WillPaginate::Collection:0x7fef7032fa48>
> If just do a hobo_index_for :floor it work fine minus sorting searching etc.
> 
> Any hints would be appreciated.  I know I'm probably doing something dumb 
> here.

Actually, the documentation is seriously lacking here - you don't actually want 
to filter the records before passing them into hobo_index_for.

The option you're looking for is :scope - but it takes a weird set of options 
that are formatted as an array of arrays:

hobo_index_for :floor, :scope => [ [:search, params[:search], :name], 
[:order_by, parse_sort_param(...)] ]

My original comment on this patch is WRONG:

https://hobo.lighthouseapp.com/projects/8324/tickets/568-hobo_index_for-should-support-scope-to-filter-records

The hash syntax mentioned there will NOT work at present, but the arrays above 
will.

--Matt Jones

-- 
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