How do you use redirect_to when the Edit action is dependent on a parameter being passed?
I have two very simple actions edit and update. Once I click submit, following an update I'd like to redirect the user back to the edit action. How do I do this if the edit action requires a parameter?
def edit
@account = Account.find_by_user_id(@params['user_id'])
end
def update
account = Account.find(params[:account_user_id])
if account.update_attributes(params[:name])
redirect_to params[:user_id].merge!(:action => :edit)
else
render :text => 'Sorry there was an error updating.'
end
end
- this code blows up