Absolute beginner here - sorry if this the answer is obvious - but i
don't know enough to search effectively !
I've started from generated scaffolding. There are now two routes to a
page that adds a 'contact' . When a contact is successfully added I
would like the system to return to the page that called it .
When I go into the add contact page I'm passing a parameter to
indicate where its come from :
<%=button_to 'New Contact ', :controller => "contacts" ,:action =>
gives a url of http://localhost:3000/contacts/new?from_folder=1
I've changed the contacts controller create method as follows
@contact = Contact.new(params[:contact])
@temp = params[:from_folder]
# @temp = 1
flash[:notice] = 'Contact was successfully created.'
if @temp == '1'
redirect_to :controller => 'folders' ,:action => 'new'
redirect_to :controller => 'chs' ,:action => 'index'
render :action => 'new'
BUT this doesnt pick up the params[:from_folder] .
Firstly is this a sensible way to approach this ? or is there another
secondly - why isnt the controller seeing the parameter ?
The new contact form is still using
<%= start_form_tag :action => 'create' %>
<%= render :partial => 'form' %>
<%= submit_tag "Create" %>
Thanks in advance