Skip to content

Instantly share code, notes, and snippets.

@leylaKapi
Created February 27, 2017 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leylaKapi/1fbf815f4f27e53190376ee89d8939f1 to your computer and use it in GitHub Desktop.
Save leylaKapi/1fbf815f4f27e53190376ee89d8939f1 to your computer and use it in GitHub Desktop.
Filter according to categories
@models = Model.joins(:categories).where('categories.id = ?', @categories_id).order("created_at DESC").paginate(page: params[:page])
- Category.all.each do |category|
%li.list-group-item
= link_to category.name, path(category: category.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment