Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined local variable or method "articles_path"

I'm trying to complete this tutorial : http://guides.rubyonrails.org/getting_started.html#say-hello-rails but i'm getting an error with this:

<%= form_for :article, url: articles_path do |f| %>

I have next error:

undefined local variable or method `articles_path' for #<#<Class:0x4646c28>:0x4661d30>
Extracted source (around line #1):       

rake routes:

Prefix Verb URI Pattern                      Controller#Action
welcome_index GET /welcome/index(.:format)   welcome#index
 articles_new GET /articles/new(.:format)    articles#new
         root GET /                          welcome#index`

ArcticlesController:

class ArticlesController < ApplicationController
  def new
  end

  def create
  end
end

Help please!

like image 256
avmatte Avatar asked May 25 '14 23:05

avmatte


Video Answer


1 Answers

I guess you forgot to add resources :articles in your config/routes.rb file. As it done in guide:

Blog::Application.routes.draw do

  resources :articles

  root 'welcome#index'
end
like image 146
zishe Avatar answered Nov 05 '22 06:11

zishe