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

--
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@googlegroups.com.
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.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 29, '12 at 1:51p
activeFeb 29, '12 at 1:51p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Fraser C.: 1 post

People

Translate

site design / logo © 2021 Grokbase