hi,
I am very frustrated by this error when I just put together a very simple project from one of the textbook on RoR: Routing Error No route matches "/employee/list" with {:method=>:get}
For your reference,
#The following is EmployeesController.rb
class EmployeesController < ApplicationController scaffold :employee # create scaffold code for controller
# override scaffold list method def list @employees = Employee.find( :all ) # return an array of all Employees end # method list end # class EmployeeController
# The following is Employee.rb class Employee < ActiveRecord::Base end
# And the following is list.rhtml,
<?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Fig. 20.22 app/views/employees/list.rhtml --> <!-- A view that displays a list of Employees. --> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>List of Employees</title> </head> <body style="background-color: lightyellow"> <h1>List of Employees</h1> <ol> <% for employee in @employees %> <!-- create a list item for every employee with his full name --> <li><%= employee.first_name %> <%= employee.last_name %></li> <% end %> </ol> </body> </html>
PLEASE HELP!!! Zhiguang