Forum: Ruby on Rails Bundled resource -- something I'm missing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steve R. (Guest)
on 2006-01-17 02:58
(Received via mailing list)
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:

<input id="filter_box_begin_date_date"
type="text" value="" />

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


Duane J. (Guest)
on 2006-01-19 16:02
(Received via mailing list)
On Jan 16, 2006, at 2:57 PM, Steve R. wrote:

> <input id="filter_box_begin_date_date" name="filter_box[begin_date]
> [date]" type="text" value="" />
> 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...
> Thoughts?

Hi Steve,

Yeah, that's my hack you've pointed out there ;)

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 topic is locked and can not be replied to.