Thanks for the feedback, Tom. Let me try again from a higher level.
I want to make an advanced search page. Now, all the search parameters I'm interested in are not simply attributes of a single model. They may be attributes that come through many different relationships. I'm trying to use form_helpers, but they generate inconsistencies and bugs when combined with url_for. So, any other ideas? - Michael
Date: Mon, 05 Feb 2007 11:46:08 -0800 From: Tom Werner <[EMAIL PROTECTED]> Subject: Re: [Sdruby] Re: Rails questions and problems To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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
