asset_path: are reserved names sneaking up on me?

I had a surprise today migrating an app from beta4 to final. Suddenly I got an error from one of my path helpers when used from inside a controller:

  redirect_to asset_path(@asset)

Some investigation revealed this commit

commit 2af8fd2829ec573ef7da8a44d31e5f25ef4a8408 Author: Jos� Valim <jose.valim@gmail.com>

    Also move asset_path to AbstractController.

diff --git a/actionpack/lib/abstract_controller/asset_paths.rb b/actionpack/lib/abstract_controller/asset_paths.rb index 16c900d..9ca2fb7 100644 --- a/actionpack/lib/abstract_controller/asset_paths.rb +++ b/actionpack/lib/abstract_controller/asset_paths.rb @@ -3,7 +3,7 @@ module AbstractController      extend ActiveSupport::Concern

     included do - config_accessor :asset_host, :assets_dir, :javascripts_dir, :stylesheets_dir + config_accessor :asset_host, :asset_path, :assets_dir, :javascripts_dir, :stylesheets_dir      end    end end

I'm sure the change was well-intentioned, but it surreptitiously grabs a rather common name and reserving it for the framework. In effect, this change precludes having an asset resource. I think this is bad.

Michael

Just as you can't have Image or Javascript resource.

There's a huge difference. Those two have been there right from the beginning. That Asset has become effectively reserved only started with Rails 3, even rather late in the process leading up to it. I'm pretty sure that there are lots of existing apps that have Asset models. Upgrading these apps has become more complicated due to the change.

Michael

You're *meant* to be able to use those, internally we use path_to_image and path_to_javascript rather than image_path and javascript_path. If you can't use those, it's a bug.

For the case of asset_path, that's definitely unintentional and we should fix it for 3.0.1 / 3.1, it'll require a little bit of trickery to have backwards compatibility for 3.0.1 but we should definitely do it. Could you open a ticket for it and mark it for 3.0.1?

Here's the ticket

https://rails.lighthouseapp.com/projects/8994-ruby-on- rails/tickets/5578-abstractcontrollerasset_path-overrides-routes-helper

However, I don't see how to mark it for a particular release.

Michael