6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/authorized/permissive_controller.rb', line 6
def permissive(*args)
options = args.
resource = options[:resource] || ActiveSupport::ModelName.new(
self.model_name.split('::').last.gsub(/Controller$/,'').singularize)
before_filter "may_create_#{resource.plural}_required",
:only => [:new,:create]
before_filter "may_read_#{resource.plural}_required",
:only => [:show,:index]
before_filter "may_update_#{resource.plural}_required",
:only => [:edit,:update]
before_filter "may_destroy_#{resource.plural}_required",
:only => :destroy
end
|