Lesha Pipiev
Lesha Pipiev

Reputation: 3333

Rails 3 Route Get No Route matches

I am under Rails 3.0.9.

I have the route:

get 'account/index'

There are such information at console:

account_index GET    /account/index(.:format)   {:controller=>"account", :action=>"index"}

But when I try http://127.0.0.1:3000/account/,
I get No route matches "/account"

Thanks in advance.

Upvotes: 0

Views: 317

Answers (3)

Prashanth
Prashanth

Reputation: 1398

Pls refer to Routes explanation for a more detailed explanation. Also, the following line (match :to =>) should be at the top of your routes.rb file before match ':controller(/:action(/:id))(.:format)'. Hope this helps.

match '/account', :to => 'account#index'

Upvotes: 1

Prashanth
Prashanth

Reputation: 1398

@Lesha, I am relatively new to Rails as well. The following would be a much more generic way in your routes file instead of a get 'controller#action'.

match ':controller(/:action(/:id))(.:format)'

After this is done, you would have to access your page using http://127.0.0.1:3000/account/index

Upvotes: 0

TimPetricola
TimPetricola

Reputation: 1491

Yes, because the route is /account/index and not /account Try get 'account#index'.

Upvotes: 0

Related Questions