Sha256: 8ac3d1f3323a1f3e806e4bf4492ebe11d19b2d53e4774c4cff38f7dcf30f7280
Contents?: true
Size: 910 Bytes
Versions: 2
Compression:
Stored size: 910 Bytes
Contents
module BeforeActions module Controller extend ActiveSupport::Concern module ClassMethods attr_reader :before_actions_block, :after_actions_block def before_actions(&block) @before_actions_block = block before_filter :execute_before_actions end def after_actions(&block) @after_actions_block = block after_filter :execute_after_actions end end def execute_before_actions block = self.class.before_actions_block _execute_command(&block) end def execute_after_actions block = self.class.after_actions_block _execute_command(&block) end def _execute_command(&block) Command.new(self).instance_eval(&block) end end end if defined? ActionController::Base ActionController::Base.class_eval do include BeforeActions::Controller end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
before_actions-1.0.2 | lib/before_actions/controller.rb |
before_actions-1.0.0 | lib/before_actions/controller.rb |