0
Hartl教程中的下一个新手问题。现在在第7章。当我运行应用程序我得到这样的事情在我的浏览器:Hartl的教程“找不到id = 1的用户”(第7章)
ActiveRecord::RecordNotFound in UsersController#show
Couldn't find User with id=1
Rails.root: C:/rails_project/my_app
Application Trace | Framework Trace | Full Trace
app/controllers/users_controller.rb:4:in `show'
Request
Parameters:
{"id"=>"1"}
Show session dump
Show env dump
Response
Headers:
None
我user_controller.rb看起来是这样的:
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
describe "profile page" do
#Code to make a user variable
before { visit user_path(user) }
it { should have_selector('h1', :text => user.name) }
it { should have_selector('title', :text => user.name) }
end
end
def new
end
end
感谢您的帮助& intrest!
您确定您的数据库中有用户吗? – 2012-08-09 21:13:25
给我打电话,但我该如何检查? – szatan 2012-08-09 21:15:33
试试这个:http://sqlitebrowser.sourceforge.net/并看看你的sqlite数据库里有什么 – 2012-08-09 21:16:54