2012-07-26 77 views
0

我正在使用Ruby Gem「databascdotcom」將Salesforce集成到Rails應用程序中,並且所有工作都正常。Salesforce發生ROR錯誤:請求的資源不存在

但要在第一次調用以下錯誤銷售人員:

**The requested resource does not exist**

如果我刷新(按Ctrl + F5)頁面再次,它沒有任何錯誤工作正常。

這裏是我的代碼:

def SalesForceFeed 
    @oppID = params[:oppid] 

    client = Databasedotcom::Client.new client.client_id #=> foo client.client_secret #=> bar 
    client.authenticate :username => "[email protected]", :password => "ThePasswordTheSecurityToken" #=> "the-oauth-token" 
    client.materialize("Opportunity") 
    begin 
     @client=SalesForce::Connection.new.client 
     @opp = Opportunity.find_by_Id(@oppID) 
    rescue Exception=>e 
    if(e.message == "The requested resource does not exist") 
     return redirect_to :action => 'SalesForceFeed', :oppid => @oppID 
    end 
    end 

在第一次調用「SalesForceFeed」它返回「請求的資源不存在」的錯誤,所以我增加了一個excepton檢查,並稱爲「SalesForceFeed」了,但我知道這不是正確的方法。

請給我一個更好的解決方法。謝謝。

+0

終於我得到了問題,在物化中添加了一個錯誤的對象,我刪除了它,並且它的固定 – 2012-07-26 13:47:16

回答

0

最後我得到了問題。物化中添加了錯誤的對象。我刪除了它,它已修復。

+0

真棒!你知道你可以自己的答覆作爲答案,以便其他人可以受益。 – Anup 2012-07-28 23:45:25

+0

你能像寫作風格之前和之後一樣編寫你的代碼嗎? – 2012-08-28 10:00:03

+0

client.materialize(「Opportunity」)被錯誤地寫成client.materialize(「Opportuniti」),所以對象名稱是錯誤的並給出了錯誤 – 2012-08-28 10:03:01