【发布时间】:2012-07-26 09:52:11
【问题描述】:
我正在使用 Ruby Gem“databascdotcom”将 Salesforce 集成到 Rails 应用程序中,一切正常。
但在第一次致电 salesforce 时出现以下错误:
**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 => "foo@bar.com", :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”时,它返回错误“请求的资源不存在”,所以我添加了一个异常检查并再次调用“SalesForceFeed”,但我知道这不是正确的方法。
请建议我一个更好的方法来解决这个问题。谢谢。
【问题讨论】:
-
最后我得到了问题,在物化中添加了一个错误的对象,我删除了它并修复了它
标签: ruby-on-rails rubygems salesforce databasedotcom-gem