Rails can i pass arguments to controllers new action

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.

On 11 February 2012 16:31, brent brent [email protected] 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

Michael P. wrote in post #1045589:

On 11 February 2012 16:31, brent brent [email protected] 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

thanks Michael