I'm brand new to Ruby on Rails, and am working through the tutorial http://edgeguides.rubyonrails.org/getting_started.html
I started by setting up an 'articles' route, and have the following routes when running 'rake routes':
'article GET /articles/:id (.:format) articles#show'
So, I see that there is a path, /articles/:id, which should map to articles#show. however, when I hit the url: /articles/1, I get the following error:
"Unknown action the action '1' could not be found in the ArticlesController"
I'm just not at all sure whats happening here. Show is defined in my articles_controller.rb:
class ArticlesController < ApplicationController
def new
end
def create
@article = Article.new(params[:article])
@article.save
redirect_to @article
end
def show
@article = Article.find(params[:id])
end
def index
@articles = Article.all
end
private
def article_params
params.require(:article).permit(:title,:text)
end
end
anyone have ideas?
Update: added Routes.rb
RailsStarter::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
get ':controller(/:action(/:id))'
root :to => 'say#hello'
# Sample resource route (maps HTTP verbs to controller actions automatically):
resources :articles
end
routes.rb
file? – Paweł Obrok/:controller/:action
matcher before your articles resource route. – Dave Newton