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



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

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

Instance Method Details

#on_feature_disabled(feature_name) ⇒ Object



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

def on_feature_disabled(feature_name)
  render :text => 'Forbidden', :status => 403
end