Hi,
I'm new to Rails, and I'd like to be able to redirect from methods in my Controller, based on the page I've come from.
I know I can do:
<%= link_to 'Show', event_path(@event, :from => 'page1') %>
and :from will be passed to params, and I can redirect based on this on my Controller.
I have a few quesetions. Firstly, is this a good idea? Is there a better way of doing it?
Secondly, how can I achieve this with the :delete method? It uses slightly different syntax, as far as I'm aware.
<%= link_to 'Delete', @event, :method => :delete %>
Thirdly, how can I achieve this with the edit action? My edit currently looks like this:
def edit @event = Event.find(params[:id]) end
And it renders a form, which I assume goes to the update action. So how can I get the param[:form] from 'edit' through the form into 'update'?
Thanks, Fraser