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



143
144
145
# File 'lib/flame/controller.rb', line 143

def self.extended(ctrl)
	ctrl.define_parent_actions
end

Instance Method Details

#define_parent_actionsObject



147
148
149
150
151
152
# File 'lib/flame/controller.rb', line 147

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



139
140
141
# File 'lib/flame/controller.rb', line 139

def inherited(ctrl)
	ctrl.define_parent_actions
end