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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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> 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 > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> http://www.spacevatican.org/2008/12/3/dates-params-and-you > > FredThank for information, it work for me. But it seems that the date time control is not fancy in rails. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---