Rails: redirect_to :controller=>'tips', :action => 'show', :id => @tip.permalink
Posted
by john
on Stack Overflow
See other posts from Stack Overflow
or by john
Published on 2010-06-11T21:35:57Z
Indexed on
2010/06/11
21:43 UTC
Read the original article
Hit count: 290
ruby-on-rails
|action
hi,
I tried to redirect rails to show action by passing controller, action, and params. However, rails ignores the name of action totally!
what I got is http://mysite/controllername/paramId
so i have error message....
here is the action code I used:
def update
@tip = current_user.tips.find(params[:id])
@tip.attributes = params[:tip]
@tip.category_ids = params[:categories]
@tip.tag_with(params[:tags]) if params[:tags]
if @tip.save
flash[:notice] = 'Tip was successfully updated.'
redirect_to :controller=>'tips', :action => 'show', :id => @tip.permalink
else
render :action => 'edit'
end
end
© Stack Overflow or respective owner