(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:

welcome_index GET    /welcome/index(.:format)     welcome#index
     articles GET    /articles(.:format)          articles#index
              POST   /articles(.:format)          articles#create
  new_article GET    /articles/new(.:format)      articles#new
 edit_article GET    /articles/:id/edit(.:format) articles#edit
      article GET    /articles/:id(.:format)      articles#show
              PATCH  /articles/:id(.:format)      articles#update
              PUT    /articles/:id(.:format)      articles#update
              DELETE /articles/:id(.:format)      articles#destroy
         root GET    /                            welcome#index

My ArticlesController class has a method 'new' with empty body.

I have views/articles/new.html.erb.


When I manually enter the URL http://localhost:3001/articles/new in my
browser, the correct page is shown.

I had expected that my link_to call() would generate a link to that very
page, but instead it throws an exception. Something seems to be missing
here.

Where am I wrong here, and how can I fix it? (I hope the information
provided is complete to answer this question).

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9bfde5ceff8c02bcb1c82907453a2cf8%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to