Skip to content
This repository
Browse code

Call it compile_methods! and do the same on AM.

  • Loading branch information...
commit 6067d1620075c1c311bbae01993453cd80967804 1 parent e1b5195
José Valim authored September 27, 2010
10  actionmailer/lib/action_mailer/railtie.rb
@@ -18,6 +18,10 @@ class Railtie < Rails::Railtie
18 18
       options.javascripts_dir ||= paths.public.javascripts.to_a.first
19 19
       options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
20 20
 
  21
+      # make sure readers methods get compiled
  22
+      options.asset_path           ||= nil
  23
+      options.asset_host           ||= nil
  24
+
21 25
       ActiveSupport.on_load(:action_mailer) do
22 26
         include AbstractController::UrlFor
23 27
         extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
@@ -25,5 +29,11 @@ class Railtie < Rails::Railtie
25 29
         options.each { |k,v| send("#{k}=", v) }
26 30
       end
27 31
     end
  32
+
  33
+    initializer "action_mailer.compile_config_methods" do
  34
+      ActiveSupport.on_load(:action_mailer) do
  35
+        config.compile_methods! if config.respond_to?(:compile_methods!)
  36
+      end
  37
+    end
28 38
   end
29 39
 end
4  actionpack/lib/action_controller/railtie.rb
@@ -38,9 +38,9 @@ class Railtie < Rails::Railtie
38 38
       end
39 39
     end
40 40
 
41  
-    config.after_initialize do
  41
+    initializer "action_controller.compile_config_methods" do
42 42
       ActiveSupport.on_load(:action_controller) do
43  
-        config.crystalize! if config.respond_to?(:crystalize!)
  43
+        config.compile_methods! if config.respond_to?(:compile_methods!)
44 44
       end
45 45
     end
46 46
   end
6  activesupport/lib/active_support/configurable.rb
@@ -10,12 +10,12 @@ module Configurable
10 10
     extend ActiveSupport::Concern
11 11
 
12 12
     class Configuration < ActiveSupport::InheritableOptions
13  
-      def crystalize!
14  
-        self.class.crystalize!(keys.reject {|key| respond_to?(key)})
  13
+      def compile_methods!
  14
+        self.class.compile_methods!(keys.reject {|key| respond_to?(key)})
15 15
       end
16 16
 
17 17
       # compiles reader methods so we don't have to go through method_missing
18  
-      def self.crystalize!(keys)
  18
+      def self.compile_methods!(keys)
19 19
         keys.each do |key|
20 20
           class_eval <<-RUBY, __FILE__, __LINE__ + 1
21 21
             def #{key}; _get(#{key.inspect}); end
2  activesupport/test/configurable_test.rb
@@ -49,7 +49,7 @@ class Child < Parent
49 49
     assert !child.config.respond_to?(:bar)
50 50
     assert !child.new.config.respond_to?(:bar)
51 51
 
52  
-    parent.config.crystalize!
  52
+    parent.config.compile_methods!
53 53
     assert_equal :foo, parent.config.bar
54 54
     assert_equal :foo, child.new.config.bar
55 55
 

0 notes on commit 6067d16

Please sign in to comment.
Something went wrong with that request. Please try again.