Skip to content

Commit

Permalink
BACKWARDS INCOMPATIBLE: Renamed application.rb to application_control…
Browse files Browse the repository at this point in the history
…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
dhh committed Nov 17, 2008
1 parent 4b33fae commit fcce1f1
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
9 changes: 1 addition & 8 deletions actionpack/lib/action_controller/dispatcher.rb
Expand Up @@ -12,14 +12,7 @@ def define_dispatcher_callbacks(cache_classes)
after_dispatch :cleanup_application after_dispatch :cleanup_application
end end


# Common callbacks to_prepare(:load_application_controller) { ApplicationController }
to_prepare :load_application_controller do
begin
require_dependency 'application' unless defined?(::ApplicationController)
rescue LoadError => error
raise unless error.message =~ /application\.rb/
end
end


if defined?(ActiveRecord) if defined?(ActiveRecord)
after_dispatch :checkin_connections after_dispatch :checkin_connections
Expand Down
6 changes: 1 addition & 5 deletions activesupport/lib/active_support/dependencies.rb
Expand Up @@ -314,11 +314,7 @@ def loadable_constants_for_path(path, bases = load_paths)
nesting = nesting[1..-1] if nesting && nesting[0] == ?/ nesting = nesting[1..-1] if nesting && nesting[0] == ?/
next if nesting.blank? next if nesting.blank?


[ [ nesting.camelize ]
nesting.camelize,
# Special case: application.rb might define ApplicationControlller.
('ApplicationController' if nesting == 'application')
]
end.flatten.compact.uniq end.flatten.compact.uniq
end end


Expand Down
5 changes: 5 additions & 0 deletions railties/CHANGELOG
@@ -1,3 +1,8 @@
*2.3.0/3.0*

* 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]


*2.2.1 [RC2] (November 14th, 2008)* *2.2.1 [RC2] (November 14th, 2008)*


* 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] * 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]
Expand Down
2 changes: 1 addition & 1 deletion railties/Rakefile
Expand Up @@ -184,7 +184,7 @@ task :copy_html_files do
end end


task :copy_application do task :copy_application do
cp "helpers/application.rb", "#{PKG_DESTINATION}/app/controllers/application.rb" cp "helpers/application_controller.rb", "#{PKG_DESTINATION}/app/controllers/application_controller.rb"
cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb" cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
end end


Expand Down
2 changes: 1 addition & 1 deletion railties/doc/guides/source/layouts_and_rendering.txt
Expand Up @@ -313,7 +313,7 @@ With those declarations, the +inventory+ layout would be used only for the +inde


Layouts are shared downwards in the hierarchy, and more specific layouts always override more general ones. For example: Layouts are shared downwards in the hierarchy, and more specific layouts always override more general ones. For example:


+application.rb+: +application_controller.rb+:


[source, ruby] [source, ruby]
------------------------------------------------------- -------------------------------------------------------
Expand Down
File renamed without changes.
Expand Up @@ -47,7 +47,8 @@ def manifest
m.file "README", "README" m.file "README", "README"


# Application # Application
m.template "helpers/application.rb", "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest } m.template "helpers/application_controller.rb", "app/controllers/application_controller.rb", :assigns => {
:app_name => @app_name, :app_secret => md5.hexdigest }
m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb" m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb"
m.template "helpers/test_helper.rb", "test/test_helper.rb" m.template "helpers/test_helper.rb", "test/test_helper.rb"
m.template "helpers/performance_test.rb", "test/performance/browsing_test.rb" m.template "helpers/performance_test.rb", "test/performance/browsing_test.rb"
Expand Down

30 comments on commit fcce1f1

@ncr
Copy link
Contributor

@ncr ncr commented on fcce1f1 Nov 17, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw that coming ;)

@tilsammans
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense for 3.0, not sure about 2.3 though.

@ryanb
Copy link
Contributor

@ryanb ryanb commented on fcce1f1 Nov 17, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@topfunky
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Those were the days.

@drnic
Copy link
Contributor

@drnic drnic commented on fcce1f1 Nov 17, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 ryanb

@thibaudgg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@jamesgolick
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!

@sethladd
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a 3.0 change, imo.

@foca
Copy link
Contributor

@foca foca commented on fcce1f1 Nov 17, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 ryanb
phase this change in gradually =)

@spicycode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally!

@jasontorres
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes more sense.

@adkron
Copy link
Contributor

@adkron adkron commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+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.

@lifo
Copy link
Member

@lifo lifo commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@boblmartens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@radar
Copy link
Contributor

@radar radar commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NZKoz
Copy link
Member

@NZKoz NZKoz commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

@labria
Copy link
Contributor

@labria labria commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At last!

@divineforest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1+ for ranaming

@geoffgarside
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@geoffgarside
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ryanb
Copy link
Contributor

@ryanb ryanb commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ryanb
Copy link
Contributor

@ryanb ryanb commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@NZKoz
Copy link
Member

@NZKoz NZKoz commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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’.

@NZKoz
Copy link
Member

@NZKoz NZKoz commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@lb
Copy link

@lb lb commented on fcce1f1 Nov 18, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abstract_application_controller.rb! whoa

@cmrichards
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ryanb
Copy link
Contributor

@ryanb ryanb commented on fcce1f1 Nov 19, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@jamieorc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huzzah!

@cmrichards
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanb i concede

@whatcould
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.