Skip to content

Commit

Permalink
filtering-stories-by-status-controller
Browse files Browse the repository at this point in the history
If you try to use the filter widget, you'll see it adds a `status` parameter in the query string. We need to pick that up and do something useful with it in the Projects controller at `app/controllers/projects_controller.rb`. Happily, we can leverage the `apply_scopes` method we earlier used in the `show` method for searching and sorting to also handle filtering by adding a `:status_is` argument:

SHOW_PATCH

Status filtering should now be working.

(To do: explain the scope being used there)
  • Loading branch information
bryanlarsen committed Nov 14, 2011
1 parent 65fc452 commit 22d0143
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/projects_controller.rb
Expand Up @@ -8,6 +8,7 @@ def show
@project = find_instance
@stories =
@project.stories.apply_scopes(:search => [params[:search], :title],
:status_is => params[:status],
:order_by => parse_sort_param(:title, :status))
end

Expand Down

0 comments on commit 22d0143

Please sign in to comment.