You don't actually need this tag method, you could directly make the job in the index
action:
def index
@posts = if params[:tag]
Post.all.tagged_with(params[:tag]).page(params[:page]).per(10)
else
Post.all.page(params[:page]).per(10)
end
end
Then you can define your route like this:
get 'tags/:tag', to: 'posts#index', as: :tag
And adapt it in your view:
<%= raw post.tag_list.map {|t| link_to t, tag_path(t), class: "tags" }.join (' ') %>