title: Ruby on Rails - redirect_to
body: <p>I'm having some trouble understanding the redirect_to statement.
  I have a model "Book" (with an boolean attribute "read")and a controller "books". Now I created a second controller "Admins" having to methods: index and change.
  The index view just renders a list off all Books with a link to the change method:</p>
  
  <pre><code>&lt;% @Books.each do |d| %&gt;
  &lt;%= d.title %&gt;&lt;br&gt;
  &lt;% if d.read==true %&gt;
  &lt;%= link_to "mark unread", change_path(:id=&gt;d.id)%&gt;
  &lt;% else %&gt;
  &lt;%= link_to "mark read", change_path(:id=&gt;d.id)%&gt;
  &lt;%end %&gt;
  </code></pre>
  
  <p>Now the change method just changes the "read" attribute:</p>
  
  <pre><code>@book=Book.find(params[:id])
  if @book.read==true
  @book.update_attributes(:read =&gt; false)
  else
  @book.update_attributes(:read =&gt; true)
  end
  redirect_to action: "index"
  </code></pre>
  
  <p>The Problem is: rails tries to redirect me to the show action using the :id as a parameter...(perhaps because the change_url is /admins/change?id=3)
  But I just want to be directed back to the index view "/admins"</p>
  
  <p>is there a way? it seems like rails always tries to redirect to the view action if there is an id as a parameter</p>
  
  <p>Thanks alot</p>
  
  <p>PS: the routes.rb contains resources:admins and resources:books</p>