title: Rails: Redirect to show only after form submission
body: <p>I'm following <a href="http://railscasts.com/episodes/37-simple-search-form" rel="nofollow">Ryan Bates' guide on search functionality</a>. I've left out the implementation of the search algorithm right now, only returning So far it's doing what it should, the only problem is that now when I visit /posts, I get automatically redirected to /posts/1. </p>
  
  <p>In my Posts controller:</p>
  
  <pre><code>  def show
    end
  
    def index
        @post = Post.search params[:search]
        puts ("----------------" + @post.to_s + "-----------")
        respond_to do |format|
          format.html { redirect_to @post }
        end
    end
  </code></pre>
  
  <p>In my index.html.erb:</p>
  
  <pre><code>&lt;%= form_tag posts_path, :method =&gt; 'get' do %&gt;
    &lt;p&gt;
      &lt;%= text_field_tag :search, params[:search] %&gt;
      &lt;%= submit_tag "Search", :name =&gt; nil %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>In my Posts.rb</p>
  
  <pre><code>def self.search(search)
    #insert search method here
    return Post.find_by_id(1)
  end
  </code></pre>
  
  <p>How can I get this so that I can visit /posts and search in my form without being automatically redirected?</p>