filter in apply_scopes / hobo_index?

53 views
Skip to first unread message

adamski

unread,
Aug 11, 2008, 2:09:05 PM8/11/08
to Hobo Users
I'm trying to get a date filter working with a table-plus tag.

Currrently I have:

hobo_index Event.apply_scopes(:user_is => params[:user],
:search => [params[:search], :title, :description, :address],
#, #,
:order_by => parse_sort_param(:title, :user))

What I want to do is somewhere in there add a condition such
as :conditions => [ :date_start => params[:date_start]]

I've tried loads of ways but each one doesnt work... I could just
leave out the apply_scopes and do it normal rails style but I want the
search functionality of the table-plus to stay.

Any help much appreciated!

Thanks
Adam

Matt Jones

unread,
Aug 11, 2008, 2:29:27 PM8/11/08
to hobo...@googlegroups.com
What happens when you use

:start_date_is => params[:date_start]

- that's what should work...

--Matt

Tom Locke

unread,
Aug 11, 2008, 3:03:04 PM8/11/08
to hobo...@googlegroups.com
Note that if you follow the *_at convention with your date column
(e.g. call it starts_at), you get automatic scopes fore before, after
and between. Then you could do:

:starts_after => params[:date_start]

Not sure if that's what you want, but I just thought I'd mention it :)

Tom

adamski

unread,
Aug 11, 2008, 3:15:30 PM8/11/08
to Hobo Users
Thanks, that did the trick :-)

Hobo is both great and annoying, in that sometimes the solutions is
just too simple to think of!!

adamski

unread,
Aug 11, 2008, 3:15:54 PM8/11/08
to Hobo Users
Thanks, I will bear that in mind - will probably come in handy.
Reply all
Reply to author
Forward
0 new messages