On 16 May 2014 12:50, Ronald Fischer <[email protected]> wrote: > (Using Rails 4.1.1 with Ruby 2.1.1 on Mac OSX 10.6 Snow Leopard) > > I'm doing a Rails tutorial (in case you are interested in: It's > http://guides.rubyonrails.org/getting_started.html), and I'm stuck on > the following: > > I create in some erb file a link using > > <%= link_to 'Add new weird stuff', controller: new_article_path %> > > and this raises the exception > > ActionController::UrlGenerationError in Articles#index > No route matches {:action=>"index", :controller=>"articles/new"} > > The helper new_article_path returns 'articles/new'. My routes are these:
The answer is in the error if you look carefully. You want it to link to controller articles, action new, but the error says that it is going to controller articles/new. It is because you have told it that the controller is articles/new, whereas in fact this is the complete path. You just need <%= link_to 'Add new weird stuff', new_article_path %> Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvr-XYBvwSXkp0hqT89_KjWjSsYkWrNnY-wiCtvCEibhQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

