2012-08-09 54 views
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!

+1

您確定您的數據庫中有用戶嗎? – 2012-08-09 21:13:25

+0

給我打電話,但我該如何檢查? – szatan 2012-08-09 21:15:33

+0

試試這個:http://sqlitebrowser.sourceforge.net/並看看你的sqlite數據庫裏有什麼 – 2012-08-09 21:16:54

回答

相關問題