Redirection problem, passing variables

Dear all

I have this in my controller:

redirect_to :action => ‘edit’

I would like to redirect to ‘edit/somenumber’ where some number is
@document.id

Is there an easy way to do this, I have tried many ways, but it doesn’t
seem to work.

Many thanks

Darren

redirect_to :action => ‘edit’, :id => @document.id

then you should have the value of @document.id in params[:id] inside
the edit action.

Hi

Thanks, after some restructuring I managed to get this working. I really
appreciate this.

Regards

Darren

Thorsten L wrote:

redirect_to :action => ‘edit’, :id => @document.id

then you should have the value of @document.id in params[:id] inside
the edit action.

Darren E. wrote:

I have this in my controller:
redirect_to :action => ‘edit’
I would like to redirect to ‘edit/somenumber’ where some number is
@document.id

Does this not work?

    redirect_to :action => 'edit', :id => @document.id

It all depends on your config/routes.rb, where the “id” field is put in
the
URL and how it is passed on.


Jens