title: Is this the best practice for routing in Rails?
body: <p>I'm pretty much an amateur when it comes to Rails. I got this to work, however I feel like the code is not efficient enough. </p>
  
  <p>Is there any way to speed this up? And also it this how a professional would do it?</p>
  
  <p>Controller</p>
  
  <pre><code>def mark_read
      @topic = Topic.find(params[:id])
      @topic.mark_as_read! :for =&gt; current_user
      redirect_to user_path(current_user.slug) 
  end
  
  def mark_all_read
      Topic.mark_as_read! :all, :for =&gt; current_user
      redirect_to user_path(current_user.slug) 
  end
  </code></pre>
  
  <p>Routes</p>
  
  <pre><code>resources :users do
    member do
      post :mark_read
      post :mark_all_read
    end
  end
  </code></pre>
  
  <p>View</p>
  
  <pre><code>&lt;% if current_user.id == @user.id %&gt;
  &lt;%= link_to "Mark all as read", mark_all_read_user_path, :method=&gt; :post %&gt;
  
  &lt;h4&gt; List of posts unread by you &lt;/h4&gt;
  &lt;% @unread.each do |topic| %&gt;
  &lt;% if @user.following?(Product.find(topic.product_id)) %&gt;
  &lt;li&gt; &lt;%= topic.title %&gt; &lt;%= link_to "Mark as read", mark_read_user_path(topic),    :method=&gt; :post %&gt; &lt;/li&gt;
  &lt;% end %&gt; 
  &lt;% end %&gt;
  </code></pre>
  
  <p>Is there someway that I could call an action in the controller without a route? I feel it would make the workflow neater.</p>