Folks Was wondering is it possible to pass args into the new action on a controller? I have some javascript that is passing in a date to action new on a controller and i want to set a field if the date was passed in. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2012-Feb-11 16:36 UTC
Re: rails can i pass arguments to controllers new action
On 11 February 2012 16:31, brent brent <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Folks > Was wondering is it possible to pass args into the new action on a > controller? I have some javascript that is passing in a date to action > new on a controller and i want to set a field if the date was passed in.http://my.rails.app/foos/new?my_date_parameter=2012-02-11 # foos controller def new @foo = Foo.new(:my_date_field => params[:my_date_parameter]) end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
brent brent
2012-Feb-11 16:41 UTC
Re: rails can i pass arguments to controllers new action
Michael Pavling wrote in post #1045589:> On 11 February 2012 16:31, brent brent <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Folks >> Was wondering is it possible to pass args into the new action on a >> controller? I have some javascript that is passing in a date to action >> new on a controller and i want to set a field if the date was passed in. > > http://my.rails.app/foos/new?my_date_parameter=2012-02-11 > > # foos controller > def new > @foo = Foo.new(:my_date_field => params[:my_date_parameter]) > endthanks Michael -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.