# using date\_select helper without an ActiveRecord model?

**URL:** <https://discuss.rubyonrails.org/t/using-date-select-helper-without-an-activerecord-model/12127>\
**Category:** rubyonrails-talk\
**Created:** [April 25, 2007, 12:44pm UTC](https://discuss.rubyonrails.org/t/using-date-select-helper-without-an-activerecord-model/12127 "2007-04-25T12:44:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Maciaszek](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@Martin\_Maciaszek](https://discuss.rubyonrails.org/u/Martin_Maciaszek)\
**Post date:** [April 25, 2007, 12:44pm UTC](https://discuss.rubyonrails.org/t/using-date-select-helper-without-an-activerecord-model/12127/1 "2007-04-25T12:44:26Z")

</div>

I would like to use a date\_select helper to select a date that will be used as a part of a condition in an ActiveRecord::find. The code I'm using looks like this:

\<%= date\_select :calendar, :show\_month, :order =\> [:month, :year] %\>

How do I get a Date object from the params submitted? I ended up with code that looks like this:

calendar = params[:calendar] my\_date = Date.new(calendar['show\_month(1i)'].to\_i,calendar['show\_month(2i)'].to\_i,calendar['show\_month(3i)'].to\_i)

This looks pretty ughly. There has to be a simpler and cleaner way to do this.

On the other hand I want the date\_select helper to have a certain date preselected. Not having an ActiveRecord object how does the object need to look like so date\_select will be able to extract the date from it?
