Forum: Ruby on Rails The usage of datetime_select

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af3cecc8af253b5acd3c09c5b67c0074?d=identicon&s=25 Valentino Lun (on9west)
on 2008-12-19 12:37
Dear all

I am a rails beginner, I would like to know how can I manipulate the
params in controller, when the datetime_select is used in form. Please
give me some advices. Thank you very much.


view/test/index.html.erb
<% form_tag :action => "search" do %>
  <%= datetime_select("from", "range", :start_year => 2007) %>
  <%= submit_tag "search" %>
<% end %>

controllers/test.rb
def search
  selected_date = How to do it here??
  @records = Record.find(:all, :conditions => "created_at >
#{selected_date}")
  render :action => 'index'
end

Many thanks
Valentino
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-19 12:42
(Received via mailing list)
On 19 Dec 2008, at 11:37, Valentino Lun wrote:

>
> Dear all
>
> I am a rails beginner, I would like to know how can I manipulate the
> params in controller, when the datetime_select is used in form. Please
> give me some advices. Thank you very much.
>
http://www.spacevatican.org/2008/12/3/dates-params-and-you

Fred
Af3cecc8af253b5acd3c09c5b67c0074?d=identicon&s=25 Valentino Lun (on9west)
on 2008-12-19 13:18
> http://www.spacevatican.org/2008/12/3/dates-params-and-you
>
> Fred

Thank for information, it work for me. But it seems that the date time
control is not fancy in rails.
This topic is locked and can not be replied to.