Bundled resource -- something I'm missing

I have a decoupled form embedded in my pages Â? a search box that has
fields Â? and of course the search fields are not in my model. However,
picking dates is a great use for the Dynarch calendar. It seems that by
using the syntax:

<%= render :partial => �filter_box¹ %>

In my view and…

<%= dynarch_date_select ‘filter_box’, ‘begin_date’ %>

I receive the following in my params hash:


I constructed a faux model FilterBox just for the occasion, but as you
expect, it can¹t be created as easily as you might think because of the
trailing ³date² in the field id.

Here¹s the generated HTML:

Is there a way I¹m not seeing to get the id to be
and the name to be ³filter_box[begin_date]²? I think it would be far
natural to use…



On Jan 16, 2006, at 2:57 PM, Steve R. wrote:

Is there a way Iâ??m not seeing to get the id to be
â??filter_box_begin_dateâ? and the name to be â??filter_box
[begin_date]â?? I think it would be far more natural to use…


Hi Steve,

Yeah, that’s my hack you’ve pointed out there :wink:

The reason for its weirdness is that I wanted dynarch to replace the
built-in Rails date_select. But the input for date and time
selection in Rails is kind of strange to begin with–it’s broken up
in to 5 parts like this:

filter_box[begin_date(1i)] # year
filter_box[begin_date(2i)] # month
filter_box[begin_date(3i)] # day
filter_box[begin_date(4i)] # hour
filter_box[begin_date(5i)] # min

In the implementation of the dynarch calendar, you need to add a
“convert_date_to_multi_params!(params[:filter_box], :begin_date)” as
soon as you can so that the extra “date” hash inside there will be
converted to the expected 1i, 2i, 3i etc. format above.

Originally, I had hoped to make this somehow automatic, but I
couldn’t find a way. The existence of the extra “date” hash is a
relic of my attempt at automating the conversion process. Does
adding the convert_date_to_multi_params! method solve the problem
you’re up against?

Duane J.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs