Hi James,
I've got a list of products. The list has a little text fields for
entering the position number. What I want to have happen is to have
the form call update for the given product, and after the update,
display the index page again. I actually got it working by doing this:
def update
unless params[:product][:new_position].nil?
Product.find(params[:id]).new_position=(params[:product]
[:new_position])
respond_to do |format|
format.html {redirect_to collection_url}
end
else
super
end
end
Is there a cleaner way to do this? :)
Thanks,
Matt
On Dec 30, 5:25 pm, "James Golick" <
jamesgol...@gmail.com> wrote:
> Hi Matt,
>
> I'm not totally clear on what you're asking. If you are simply asking
> how to change the redirect from the update action, try this:
>
> update.wants.html { redirect_to collection_url }
>
> Otherwise, I'll need some more details.
>