Skip to content

Commit

Permalink
more-auto-actions
Browse files Browse the repository at this point in the history
We'll now continue and configure the available actions for all of the controllers. So far we've seen the black-list style where you list what you *don't* want:

    auto_actions :all, :except => :index
{: .ruby}

There's also white-list style where you list what you do want, e.g.

    auto_actions :index, :show
{: .ruby}

There's also a handy shortcut to get just the read-only routes (i.e. the ones that don't modify the database)

	auto_actions :read_only
{: .ruby}

The opposite is handy for things that are manipulated by ajax but never viewed directly:

	auto_actions :write_only # short for -- :create, :update, :destroy
{: .ruby}

Work through your controllers and have a think about which actions you want. You need to end up with:

SHOW_PATCH

Have a play with the application with this set of actions in place. Looking pretty good!
  • Loading branch information
bryanlarsen committed Nov 14, 2011
1 parent ca595ec commit c010f8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/stories_controller.rb
Expand Up @@ -2,7 +2,7 @@ class StoriesController < ApplicationController

hobo_model_controller

auto_actions :all
auto_actions :all, :except => :index

auto_actions_for :project, [:new, :create]

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tasks_controller.rb
Expand Up @@ -2,7 +2,7 @@ class TasksController < ApplicationController

hobo_model_controller

auto_actions :all, :except => :index
auto_actions :write_only, :edit

auto_actions_for :story, :create

Expand Down

0 comments on commit c010f8c

Please sign in to comment.