Module: Flame::Controller::ParentActions

Defined in:
lib/flame/controller.rb

Overview

Module for public instance methods re-defining from superclass

Examples:

Inherit controller with parent actions by ‘extend`

class MyController < BaseController
  extend Flame::Controller::ParentActions
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(ctrl) ⇒ Object



196
197
198
# File 'lib/flame/controller.rb', line 196

def self.extended(ctrl)
  ctrl.define_parent_actions
end

Instance Method Details

#define_parent_actionsObject



200
201
202
203
204
205
# File 'lib/flame/controller.rb', line 200

def define_parent_actions
  superclass.actions.each do |public_method|
    um = superclass.public_instance_method(public_method)
    define_method public_method, um
  end
end

#inherited(ctrl) ⇒ Object



192
193
194
# File 'lib/flame/controller.rb', line 192

def inherited(ctrl)
  ctrl.define_parent_actions
end