# Select\_date

**URL:** <https://www.ruby-forum.com/t/select-date/132190>\
**Category:** Rails\
**Created:** [March 17, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/select-date/132190 "2008-03-17T19:36:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 17, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/select-date/132190/1 "2008-03-17T19:36:02Z")

</div>

actually i have one select\_date tag…i choose one date from there.  
and then write query related to this…but the query is not run…please  
provide some simple code of view and controller.very urgent…

---

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 17, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/select-date/132190/2 "2008-03-17T21:17:35Z")

</div>

I’ll assume that the date is used to select Info instances based on  
their created\_on date. In your view you’ll have something like this:

\<% form\_for :info, :url=\>search\_infos\_path do |f| %\>  
\<%= f.label\_for :created\_on, “Select info for” %\>  
\<%= f.date\_select :created\_on %\>  
\<% end %\>

In your InfosController:

def search  
@infos = Info.find(:all, :conditions=\>{:created\_on=\>params[:info]  
[:created\_on]}  
respond\_to do |format|  
…  
end  
end

On Mar 17, 2:36 pm, Subhadip Chakraborty \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 18, 2008, 12:32am UTC](https://www.ruby-forum.com/t/select-date/132190/3 "2008-03-18T00:32:29Z")

</div>

On Mar 17, 8:16 pm, AndyV [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def search  
> @infos = Info.find(:all, :conditions=\>{:created\_on=\>params[:info]  
> [:created\_on]}

Not quite select\_date (and date\_select) both result in 3 separate  
parameters being submitted (year/month/day). If you’re passing the  
params hash into SomeModel.new or update\_attributes (and thus leaning  
on the MultiparameterAssignment stuff in rails) you need to pass them  
into Date::civil or Time.mktime yourself (I’m pretty sure I’ve written  
the exact same post at least twice in the past few days - odd)

Fred

---

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 18, 2008, 2:47am UTC](https://www.ruby-forum.com/t/select-date/132190/4 "2008-03-18T02:47:59Z")

</div>

Right again, Fred. I was blowing right by that.

On Mar 17, 7:31 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
