Module: ActsAsPolymorphicController::ClassMethods

Defined in:
lib/acts_as_polymorphic_controller/controller.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_polymorphic_controllerObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 7

def acts_as_polymorphic_controller
  # Set up the class methods                                      
  (class << self; self; end).instance_eval do
    define_method :aapc_resources do |*resources|
      define_method(:initialize) do
        super
        
        @aapc_parent_objects = resources                
      end #define initialize
    end # define aapc_resources
  end # instance eval
  
  # Set up instance methods
  include ActsAsPolymorphicController::InstanceMethods
  
end