diff options
Diffstat (limited to 'app/controllers/concerns/activatable.rb')
| -rw-r--r-- | app/controllers/concerns/activatable.rb | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/app/controllers/concerns/activatable.rb b/app/controllers/concerns/activatable.rb new file mode 100644 index 000000000..1a34551a9 --- /dev/null +++ b/app/controllers/concerns/activatable.rb @@ -0,0 +1,11 @@ +module Activatable +  extend ActiveSupport::Concern + +  %w(activate deactivate).each do |action| +    define_method action do +      authorize resource, "#{action}?" +      resource.send "#{action}!" +      redirect_to request.referer || [current_referential, resource] +    end +  end +end | 
