Skip to content
This repository
Browse code

BACKWARDS INCOMPATIBLE: Renamed application.rb to application_control…

…ler.rb and removed all the special casing that was in place to support the former. You must do this rename in your own application when you upgrade to this version [DHH]
  • Loading branch information...
commit fcce1f17eaf9993b0210fe8e2a8117b61a1f0f69 1 parent 4b33fae
David Heinemeier Hansson authored November 17, 2008
9  actionpack/lib/action_controller/dispatcher.rb
@@ -12,14 +12,7 @@ def define_dispatcher_callbacks(cache_classes)
12 12
           after_dispatch :cleanup_application
13 13
         end
14 14
 
15  
-        # Common callbacks
16  
-        to_prepare :load_application_controller do
17  
-          begin
18  
-            require_dependency 'application' unless defined?(::ApplicationController)
19  
-          rescue LoadError => error
20  
-            raise unless error.message =~ /application\.rb/
21  
-          end
22  
-        end
  15
+        to_prepare(:load_application_controller) { ApplicationController }
23 16
 
24 17
         if defined?(ActiveRecord)
25 18
           after_dispatch :checkin_connections
6  activesupport/lib/active_support/dependencies.rb
@@ -314,11 +314,7 @@ def loadable_constants_for_path(path, bases = load_paths)
314 314
         nesting = nesting[1..-1] if nesting && nesting[0] == ?/
315 315
         next if nesting.blank?
316 316
 
317  
-        [
318  
-          nesting.camelize,
319  
-          # Special case: application.rb might define ApplicationControlller.
320  
-          ('ApplicationController' if nesting == 'application')
321  
-        ]
  317
+        [ nesting.camelize ]
322 318
       end.flatten.compact.uniq
323 319
     end
324 320
 
5  railties/CHANGELOG
... ...
@@ -1,3 +1,8 @@
  1
+*2.3.0/3.0*
  2
+
  3
+* BACKWARDS INCOMPATIBLE: Renamed application.rb to application_controller.rb and removed all the special casing that was in place to support the former. You must do this rename in your own application when you upgrade to this version [DHH]
  4
+
  5
+
1 6
 *2.2.1 [RC2] (November 14th, 2008)*
2 7
 
3 8
 * Fixed plugin generator so that generated unit tests would subclass ActiveSupport::TestCase, also introduced a helper script to reduce the needed require statements #1137 [Mathias Meyer]
2  railties/Rakefile
@@ -184,7 +184,7 @@ task :copy_html_files do
184 184
 end
185 185
 
186 186
 task :copy_application do
187  
-  cp "helpers/application.rb", "#{PKG_DESTINATION}/app/controllers/application.rb"
  187
+  cp "helpers/application_controller.rb", "#{PKG_DESTINATION}/app/controllers/application_controller.rb"
188 188
   cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
189 189
 end
190 190
 
2  railties/doc/guides/source/layouts_and_rendering.txt
@@ -313,7 +313,7 @@ With those declarations, the +inventory+ layout would be used only for the +inde
313 313
 
314 314
 Layouts are shared downwards in the hierarchy, and more specific layouts always override more general ones. For example:
315 315
 
316  
-+application.rb+:
  316
++application_controller.rb+:
317 317
 
318 318
 [source, ruby]
319 319
 -------------------------------------------------------
0  railties/helpers/application.rb → railties/helpers/application_controller.rb
File renamed without changes
3  railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -47,7 +47,8 @@ def manifest
47 47
       m.file "README",         "README"
48 48
 
49 49
       # Application
50  
-      m.template "helpers/application.rb",        "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest }
  50
+      m.template "helpers/application_controller.rb", "app/controllers/application_controller.rb", :assigns => { 
  51
+        :app_name => @app_name, :app_secret => md5.hexdigest }
51 52
       m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb"
52 53
       m.template "helpers/test_helper.rb",        "test/test_helper.rb"
53 54
       m.template "helpers/performance_test.rb",   "test/performance/browsing_test.rb"

30 notes on commit fcce1f1

Jacek Becela

Saw that coming ;)

Joost Baaij

Makes sense for 3.0, not sure about 2.3 though.

Ryan Bates

Maybe still load application.rb if it exists and spit out a deprecation notice? That way there can be a transitioning version.

Geoffrey Grosenbach

I remember way back when…“ApplicationController” was just called “Application.”

Those were the days.

Dr Nic Williams

+1 ryanb

Thibaud Guillaume-Gentil

great!

Seth Ladd

This should be a 3.0 change, imo.

Nicolás Sanguinetti

+1 ryanb phase this change in gradually =)

Chad Humphries

Finally!

Jason Torres

that makes more sense.

Amos King

+1 for ryanb. Any big api change should at lease get some deprecation warning and isn’t this a little much for a minor release.

Pratik
Owner

We haven’t really decided if 2.2.next will be 2.3 or 3.0. Also, ‘rake rails:update’ task should/will take care of renaming application.rb → application_controller.rb.

Bob Martens

Isn’t 2.3 going to be released as 3.0? I thought that is how it worked. 1.2.x lead to 2.0.x … so 2.2.x will give way to 3.0.x!

Regardless, keep up the good work!

Ryan Bigg

I remember when this was being discussed. Glad to see it finally making its way into core!

Michael Koziarski
Owner

When this gets pushed into a release we’ll naturally take care to make the upgrade path as smooth as possible.

However, if you’re tracking edge right now, just after a branch, you’re braver than I am :)

Dimitri Krassovski

At last!

Alexander Balashov

1+ for ranaming

Geoff Garside

Anyone else getting an ActionController::MethodNotAllowed when visiting / since this?

Geoff Garside

nm its unrelated, seems map.root is generating me a POST rather than a GET route :S

Ryan Bates

I still think a transitioning version (where application.rb is loaded and deprecated) would be nice. Not for development (it’s easy enough to rename a file), but for deployment in production. Now you’ll have to push this change to the server the exact same time you upgrade Rails. Having a stepping-stone version where both application.rb and application_controller.rb work would ease this transition.

Ryan Bates

After thinking about it a bit more I suppose it’s not as big of an issue. It’s easy enough to make a second branch, change the gem version in the config, fix all the problems, and then deploy that all to the server in one go.

Michael Koziarski
Owner

@ryanb: 2.2.something could end up being the transitioning version you’re talking about, or we could add the deprecation / warnings into master.

Again, this isn’t how we’re going to ship anything, and chasing edge is risky, especially this soon after a branch where we have a bunch of features / patches we pushed out as ‘too risky’.

Michael Koziarski
Owner

@topfunky: oh yeah, well I remember abstract_application_controller.rb. Take that!

Luca

abstract_application_controller.rb! whoa

Chris

My only problem with calling it application_controller is that it indicates that it is a controller in MVC, which it isn’t. It has features that all other controllers share.

Ryan Bates

@evilgeenius the class has been called ApplicationController for quite some time. This patch just makes the file name consistent with the class name. Consistency is a good thing.

Jamie Orchard-Hays

huzzah!

Chris

@ryanb i concede

David Reese

With this commit you’ll need to update your phusion passenger — but it might be better to hack the solution yourself than try to be fancy and update the gem.

See my note in comments at http://ryandaigle.com/articles/2008/11/19/what-s-new-in-edge-rails-application-rb-duality-is-no-more

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