Consul 0.3.0 has a shortcut to quickly create an action map for CRUD controllers

Posted . Visible to the public.

In moderately complex authorization scenarios you will often find yourself writing a map like this:

class NotesController < ApplicationController
  power :notes, :map => {
    [:edit, :update] => :updatable_notes
    [:new, :create] => :creatable_notes
    [:destroy] => :destroyable_notes
  }
end

Because this pattern is so common, Consul now has a shortcut :crud to do the same:

class NotesController < ApplicationController
  power :crud => :notes
end
Profile picture of Henning Koch
Henning Koch
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2012-07-04 09:08)