I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at firstname.lastname@example.org. Thanks in advance for any leads!
Filter Page Results By Column Value In Rails
Posted by Weston Ganger
My posts have a categories, I wanted to filter the index page results for specific categories. Here is how to do it
<%= link_to "Rails Results", index_path(:category_id=>"3")
def index if params[:category_id] @posts = Post.where(:category_id => params[:category_id]) else @posts = Post.all end end