Hi --

On Wed, 16 Sep 2009, Felix Schäfer wrote:

>
>
> Am 16.09.2009 um 15:03 schrieb David A. Black:
>
>>
>> On Wed, 16 Sep 2009, steve bell wrote:
>>
>>>
>>> Hi there, just starting to get my head around routes but have a
>>> problem that I can't google my way out of. I have a restful resource
>>> that's mapped as:
>>>
>>> map.resources :terms
>>>
>>> which gives me  localhost/terms, however I want it to be localhost/
>>> buzzwords instead.
>>>
>>> I tried using path_prefix but this just added the prefix before /
>>> terms. I guess I really want a path_replace kind of thing...
>>>
>>> Refactoring the code would be a real pain. Is there any way to do
>>> this
>>> in the routes.rb file?
>>
>> You need to invert the logic:
>>
>>   map.resources :buzzwords, :controller => "terms"
>
> Or the other way round:
>
> map.resources :terms, :as => 'buzzwords'

True, though I guess I like being able to see the name up front. It
seems like a more "top down" way: the resource mapping is buzzwords,
the implementation involves the terms controller, etc.

(Unless there's some subtle difference that I'm overlooking in the
effect they have.)


David

-- 
David A. Black, Director
Ruby Power and Light, LLC (http://www.rubypal.com)
Ruby/Rails training, consulting, mentoring, code review
Book: The Well-Grounded Rubyist (http://www.manning.com/black2)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to