Hi All,

Thanks for the tips!

To expand on my original thinking... I assumed documents_path
generated the path by looking for a route with controller=>documents,
action=>index. I guess that's not necessarily the case.

Anyway, I tried:
  resources :documents, :only => [:index], :path => ''
  resources :documents, :except => [:index]

But found that it did indeed cause problems when creating a document,
as Pat had warned.

However, this:
  resources :documents, :only => [:index, :create], :path => ''
  resources :documents, :except => [:index]

Gave me exactly the behaviour I wanted.

Thanks guys!

Cheers,
Chris


On Tue, Jul 19, 2011 at 3:18 PM, Rob Zolkos <[email protected]> wrote:
> should be root_path if its / ?
>
> On 19/07/2011, at 4:17 PM, Chris Berkhout wrote:
>
>> Hi All,
>>
>> I have a documents model that is the main model in my app.
>>
>> I want "/documents" to just be "/" when looking at the listing, but
>> http://cb.dev/documents/4e1082eccf72e3696b000001 for an individual
>> document page (I'm using Mongoid).
>>
>> So I updated routes to be:
>>
>> CB::Application.routes.draw do
>>  root :to => 'documents#index'
>>  resources :tags
>>  resources :sources
>>  resources :people
>>  resources :documents, :except => :index
>> end
>>
>> Which produces the expected routes:
>> https://gist.github.com/5d1b377e99c63016fd22
>>
>> The problem is that I expected the "documents_path" helper to return
>> "/" (the first matching route), but it still goes to "/documents".
>>
>> Am I missing something?
>>
>> By the way, this is Rails 3.1.0.rc4.
>>
>> Cheers,
>> Chris
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Ruby or Rails Oceania" 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/rails-oceania?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" 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/rails-oceania?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" 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/rails-oceania?hl=en.

Reply via email to