Module: Arturo::ControllerFilters

Defined in:
lib/arturo/controller_filters.rb

Overview

Adds before filters to controllers for specifying that actions require features to be enabled for the requester.

To configure how the controller responds when the feature is not enabled, redefine #on_feature_disabled(feature_name). It must render or raise an exception.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


12
13
14
# File 'lib/arturo/controller_filters.rb', line 12

def self.included(base)
  base.extend Arturo::ControllerFilters::ClassMethods
end

Instance Method Details

#on_feature_disabled(feature_name) ⇒ Object


16
17
18
# File 'lib/arturo/controller_filters.rb', line 16

def on_feature_disabled(feature_name)
  render (Rails::VERSION::MAJOR < 5 ? :text : :plain) => 'Forbidden', :status => 403
end