vovayartsev
2011-Jul-31 18:35 UTC
Looks like an error in docs for ActionDispatch::Routing::Mapper::Resources
Please take a look at this page: http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resource It reads: :path Set a path prefix for this resource. resources :posts, :path => "admin" All actions for this resource will now be at /admin/posts. For me (Rails 3.0.9) it routes to just "/admin", not "/admin/posts". In other words, it just renames the "posts" part of the URL to whatever specified rather than adding a prefix. I actually like this behavior (this is what I was looking for), but the docs are misleading. Can anyone else check if the :path option works the same way for him/ her? -- 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.
Chris Mear
2011-Aug-03 16:50 UTC
Re: Looks like an error in docs for ActionDispatch::Routing::Mapper::Resources
On 31 July 2011 19:35, vovayartsev <vovayartsev@gmail.com> wrote:> Please take a look at this page: > > http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resource > > It reads: > > :path > Set a path prefix for this resource. > resources :posts, :path => "admin" > All actions for this resource will now be at /admin/posts. > > For me (Rails 3.0.9) it routes to just "/admin", not "/admin/posts". > In other words, it just renames the "posts" part of the URL to > whatever specified rather than adding a prefix. I actually like this > behavior (this is what I was looking for), but the docs are > misleading. > > Can anyone else check if the :path option works the same way for him/ > her?Just checked it, and you are correct. It looks like the API doc for this has been fixed in 3-1-stable and master: https://github.com/rails/rails/commit/9f9446f27110a0d55462 but this hasn''t been back-ported to 3-0-stable (yet). Chris -- 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.
Xavier Noria
2011-Aug-05 00:07 UTC
Re: Looks like an error in docs for ActionDispatch::Routing::Mapper::Resources
On Wed, Aug 3, 2011 at 6:50 PM, Chris Mear <chrismear@gmail.com> wrote:> On 31 July 2011 19:35, vovayartsev <vovayartsev@gmail.com> wrote: >> Please take a look at this page: >> >> http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resource >> >> It reads: >> >> :path >> Set a path prefix for this resource. >> resources :posts, :path => "admin" >> All actions for this resource will now be at /admin/posts. >> >> For me (Rails 3.0.9) it routes to just "/admin", not "/admin/posts". >> In other words, it just renames the "posts" part of the URL to >> whatever specified rather than adding a prefix. I actually like this >> behavior (this is what I was looking for), but the docs are >> misleading. >> >> Can anyone else check if the :path option works the same way for him/ >> her? > > Just checked it, and you are correct. It looks like the API doc for > this has been fixed in 3-1-stable and master: > > https://github.com/rails/rails/commit/9f9446f27110a0d55462 > > but this hasn''t been back-ported to 3-0-stable (yet).Just pushed a backport for 3-0-stable. Thanks! -- 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.
Reasonably Related Threads
- Help: delegated association 'App' returning ActionDispatch::Integration::Session instead
- Error reverse engineering MySQL with RMRE
- Should to_io be added to ActionDispatch::Http::UploadedFile?
- Can't use ActionDispatch::Request in Rails middleware because path_parameters get lost
- [PATCH] ActionDispatch MemCacheStore violates encapsulation principle