Hi Chris,

That looks like the expected behaviour to me, you're calling documents_path so 
you're getting /documents, if you call root_path you will get /.

If you want to redirect /documents to / add a route like 
match "/documents" => redirect("/") 
above your resources :documents declaration.

Hope this helps,

– Ivan

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.

Reply via email to