lundi 8 juin 2015

Ruby on Rails first steps

I have installed ROR+apache2 on my Linux VM (TurnKey Rails VM image) and making first steps folowing http://ift.tt/IsdtVd this guide

i have stucked on adding resource calling articles. What i have done my routes.rb:

root@rails www/blog# cat ./config/routes.rb 
Blog::Application.routes.draw do

  resources :articles

  root 'welcome#index'



end

my rake routes

root@rails www/blog# rake routes
      Prefix Verb   URI Pattern                  Controller#Action
    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

then folowing guide:

rails g controller articles

after that in browser "/" working fine, im getting my "hello, rails" but "/articles/" or "/articles/new" returns 404 - not found. (The page you were looking for doesn't exist.)

Many time spended Google has no result except of i confiured somehow debbugging in production log and get some similar error

[2015-06-08T13:39:55.326663 #14421] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/blog/articles/new"):

The question is what am i doing wrong, and how can i debug this like issues. Thx!

Aucun commentaire:

Enregistrer un commentaire