You need to pass the id of the category
You can then do (in your list_by_category action) @posts = Category.find(params[:id]).posts.
You need to pass the id of the category
You can then do (in your list_by_category action) @posts = Category.find(params[:id]).posts.