# Redirect\_to :controller=\>'tips', :action =\> 'show'

**URL:** <https://www.ruby-forum.com/t/redirect-to-controller-tips-action-show/190046>\
**Category:** Rails\
**Created:** [June 12, 2010, 12:15am UTC](https://www.ruby-forum.com/t/redirect-to-controller-tips-action-show/190046 "2010-06-12T00:15:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnuseast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@johnuseast](https://www.ruby-forum.com/u/johnuseast)\
**Post date:** [June 12, 2010, 12:15am UTC](https://www.ruby-forum.com/t/redirect-to-controller-tips-action-show/190046/1 "2010-06-12T00:15:19Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![johnuseast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@johnuseast](https://www.ruby-forum.com/u/johnuseast)\
**Post date:** [June 16, 2010, 10:56am UTC](https://www.ruby-forum.com/t/redirect-to-controller-tips-action-show/190046/2 "2010-06-16T10:56:34Z")

</div>

John U. wrote:

> 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](http://mysite/controllername/paramId)
> 
> 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  
> you can try redirect\_to(tip\_path(@tip))

Amar D.

> **[RailsTech.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=railstech.com)**
>
> Customer service is our #1 priority. Get a premium domain for your website today. Financing available.

---

<div class="post-metadata">

**Author:** ![johnuseast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@johnuseast](https://www.ruby-forum.com/u/johnuseast)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/redirect-to-controller-tips-action-show/190046/3 "2010-06-17T16:22:19Z")

</div>

On Jun 11, 11:15 pm, John U. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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 ishttp://mysite/controllername/paramId

With a normal set of restful routes (ie if you’ve got  
map.resources :tips in your routes files), the normal show url for the  
tip with id 123 IS /tips/123

Fred
