module Flame::Controller::ParentActions

Module for public instance methods re-defining from superclass @example Inherit controller with parent actions without forbidden actions by `extend`

class MyController < BaseController
  FORBIDDEN_ACTIONS = %[foo bar baz].freeze
  extend Flame::Controller::ParentActions
end

Public Class Methods

extended(ctrl) click to toggle source
# File lib/flame/controller.rb, line 223
def self.extended(ctrl)
        ctrl.define_parent_actions
end

Public Instance Methods

define_parent_actions() click to toggle source
# File lib/flame/controller.rb, line 227
def define_parent_actions
        (superclass.actions - self::FORBIDDEN_ACTIONS).each do |public_method|
                um = superclass.public_instance_method(public_method)
                define_method public_method, um
        end
end
inherited(ctrl) click to toggle source
# File lib/flame/controller.rb, line 219
def inherited(ctrl)
        ctrl.define_parent_actions
end