Hartl教程中的新手问题。现在在第7章。当我正在运行App时,我在浏览器中收到类似的内容:
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
感谢您的帮助&amp; intrest!
答案 0 :(得分:0)