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> Date: Sat Jul 24 00:47:48 2010 +0200 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 -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Evgeniy Dolzhenko
2010-Sep-07 10:16 UTC
Re: asset_path: are reserved names sneaking up on me?
Just as you can''t have Image or Javascript resource. On Tue, Sep 7, 2010 at 1:58 PM, Michael Schuerig <michael@schuerig.de> wrote:> > 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> > Date: Sat Jul 24 00:47:48 2010 +0200 > > 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 > > -- > Michael Schuerig > mailto:michael@schuerig.de > http://www.schuerig.de/michael/ > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Michael Schuerig
2010-Sep-07 10:53 UTC
Re: asset_path: are reserved names sneaking up on me?
On Tuesday 07 September 2010, Evgeniy Dolzhenko wrote:> 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 -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Michael Koziarski
2010-Sep-08 04:18 UTC
Re: Re: asset_path: are reserved names sneaking up on me?
On Tue, Sep 7, 2010 at 10:53 PM, Michael Schuerig <michael@schuerig.de> wrote:> On Tuesday 07 September 2010, Evgeniy Dolzhenko wrote: >> Just as you can''t have Image or Javascript resource.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? -- Cheers Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Michael Schuerig
2010-Sep-08 06:18 UTC
Re: asset_path: are reserved names sneaking up on me?
On Wednesday 08 September 2010, Michael Koziarski wrote:> On Tue, Sep 7, 2010 at 10:53 PM, Michael Schuerig<michael@schuerig.de> wrote:> > On Tuesday 07 September 2010, Evgeniy Dolzhenko wrote: > >> Just as you can''t have Image or Javascript resource. > > 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 -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.