user3763712
user3763712

Reputation: 13

error for routing in [GET] "/articles/new"'

I'm going through "Getting Started with Rails" and I'm stuck on Chapter 5.1. I tried:

rails g controller articles

I tried to open the articles/new, I get this error message below:

No route matches [GET] "/articles/new"
Rails.root: C:/Sites/blog

Then I run rake routes and my command prompts:

You don't have any routes defined!  Please add some routes in config/routes.rb'

Here is my routes.rb:

  Blog::Application.routes.draw do
  get "welcome/index"

  root 'welcome#index'
end

Upvotes: 1

Views: 2103

Answers (1)

Gergo Erdosi
Gergo Erdosi

Reputation: 42048

You need to add resources :articles to routes.rb:

Blog::Application.routes.draw do
  root 'welcome#index'
  resources :articles
end

You can learn more about routing in the Ruby on Rails Guides.

Upvotes: 7

Related Questions