# Redirect\_to issue

**URL:** <https://www.ruby-forum.com/t/redirect-to-issue/189787>\
**Category:** Rails\
**Created:** [June 7, 2010, 6:53pm UTC](https://www.ruby-forum.com/t/redirect-to-issue/189787 "2010-06-07T18:53:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [June 7, 2010, 6:53pm UTC](https://www.ruby-forum.com/t/redirect-to-issue/189787/1 "2010-06-07T18:53:53Z")

</div>

I’m having trouble getting redirect\_to to work.  
I have a search controller with the following code:

```
if params[:format].include?("map")
  source = params[:format].split('_').second
  redirect_to :controller => "geodatas", :action => "map", :source

```

=\> “samples\_”+source  
else  
#if params[:jointables].include?(“images”)  
if params[:viewtable] == “images”  
redirect\_to :controller =\> “images”, :action =\> “list”  
else  
redirect\_to :controller =\> “samples”, :action =\>  
“resultslist”, :id=\>nil  
end  
end

In the last else it is supposed to redirect to the resultslist action  
of the samples controller, but it is going to the show action  
instead. This is the error that shows in the browser.

ActiveRecord::RecordNotFound in SamplesController#show

Couldn’t find Sample with ID=resultslist

Why is it going to the show action??

---

<div class="post-metadata">

**Author:** ![Mlle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Post date:** [June 7, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/redirect-to-issue/189787/2 "2010-06-07T19:10:16Z")

</div>

On 7 June 2010 17:52, Mlle [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> redirect_to :controller => "images", :action => "list"
> 
> ```
> 
> ActiveRecord::RecordNotFound in SamplesController#show
> 
> Couldn’t find Sample with ID=resultslist
> 
> Why is it going to the show action??

Have a look in the log (log/development.log) and see if that helps

Colin
