clemens (owner)

Revisions

gist: 132566 Download_button fork
public
Public Clone URL: git://gist.github.com/132566.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'rubygems'
require 'activesupport'
 
module ActionController
end
 
class ActionController::Base
end
 
module ActionController::Helpers
  def self.included(base)
    puts 'ActionController::Helpers included'
    puts '--------------------------------'
    base.extend(ClassMethods)
    base.class_eval do
      class << self
        alias_method_chain :inherited, :helper
      end
    end
  end
 
  module ClassMethods
    private
    def inherited_with_helper(child)
      puts 'ActionController::Helpers inherited'
      puts 'ActionController::Helpers before inherited_without_helper'
      inherited_without_helper(child)
      puts 'ActionController::Helpers after inherited_without_helper'
    end
  end
end
 
ActionController::Base.send(:include, ActionController::Helpers)
 
Class.class_eval do
  def inherited_with_mixins(child)
    puts 'Class inherited'
    puts 'Class before inherited_without_extension'
    inherited_without_mixins(child)
    puts 'Class after inherited_without_extension'
  end
  alias_method_chain :inherited, :mixins
end
 
class ApplicationController < ActionController::Base
end
 
puts '--------------------------------'
 
class BaseController < ApplicationController
end