I think it's a problem of not understanding what you're trying to
accomplish. Can you explain your interface and requirements at a higher
level. There's probably an elegant Rails solution but we need to know
exactly how you want it to behave.
Tom
Michael Frederick wrote:
Sorry for the bump, but I think some of the excitement over railsconf
may have overshadowed my questions. :-)
On 2/1/07, Michael Frederick <[EMAIL PROTECTED]> wrote:
I've been having some problems with designing an advanced search page,
and how to integrate the functionality with normal Rails paradigms.
The basic approach has been to make a search object, and I have done
this (for now) by using a Struct. This way, I can use the
form_helpers, and they will receive the default value of the search
param corresponding to each field. Should I try and make this a model
instead? Or some other type of class that will integrate well?
So, I use form_helpers, and then I want to be able to allow further
refining and reordering of the search using links. It's not exactly
pagination, but it's a similar idea. But currently, with either Edge
Rails or 1.2, url_for breaks on params generated with form_helpers.
Specifically, it doesn't handle nested params of the form foo[bar],
which is what form_helpers generate.
I then found some helper scripts online at
http://www.marklunds.com/articles/one/314
This helps retain the correct nested params, but then there is another
problem with multi-valued selects (and I guess checkboxes). Instead of
generating urls like:
index?foo[bar][]=1&foo[bar][]=2
with url_for you get one like:
index?foo[bar][]=1/2
Which then is not interpreted correctly later on reentry into Rails.
So, is there a better way to handle this? I'd like to get the
multi-valued stuff working somehow. Maybe the fault lies in the
combination of the form_helpers and the url_for (and link_to), but
that would seem to be a major blemish on Rails. If I can use all that
stuff, it makes all of my form elements one-liners, and very easy to
read and re-use.
Sorry for the novel-length post...
- Michael
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby