Module: SafetyCone::Filter
- Defined in:
- lib/safety_cone/filter.rb
Overview
Module for Filtering requests and raise notices and take measures
Class Method Summary collapse
-
.included(base) ⇒ Object
Method to include to base class.
Instance Method Summary collapse
-
#safety_cone_filter ⇒ Object
Filter method that does the SafetyCone action based on the configuration.
Class Method Details
.included(base) ⇒ Object
Method to include to base class. This lets declare a before filter here
7 8 9 |
# File 'lib/safety_cone/filter.rb', line 7 def self.included(base) base.before_filter :safety_cone_filter end |
Instance Method Details
#safety_cone_filter ⇒ Object
Filter method that does the SafetyCone action based on the configuration.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/safety_cone/filter.rb', line 13 def safety_cone_filter if cone = fetch_cone if cone.type == 'notice' flash.now["safetycone_#{notice_type(cone.type)}"] = cone. else flash["safetycone_#{notice_type(cone.type)}"] = cone. end redirect_to safety_redirect if cone.type == 'block' end end |