我使用Ruby Gemdatabascdotcom将Salesforce集成到Rails应用程序中,并且一切正常。
I am using the Ruby Gem "databascdotcom" to integrate Salesforce in a Rails app and all works fine.
但首次调用salesforce时出现错误:
But getting following error on first call to salesforce:
**请求的资源不存在**
如果我再次刷新(Ctrl + F5)页面,它工作正常,没有任何错误。
If I refresh (Ctrl + F5) the page again, it works fine without any error.
以下是我的代码:
Here is my code:
def SalesForceFeed @oppID = params[:oppid] client = Databasedotcom::Client.new client.client_id #=> foo client.client_secret #=> bar client.authenticate :username => "foo@bar", :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,但我知道这不是正确的方法。
On the first call to "SalesForceFeed" it returned the error "The requested resource does not exist", so I added an excepton check and called "SalesForceFeed" again, but I know this is not the right way.
请建议我一个更好的方法来解决这个问题。谢谢。
Please suggest me a better way to fix this. Thanks.
推荐答案最后我得到了这个问题。物化中添加了错误的对象。我删除了它,它是固定的。
Finally i got the issue. There was a wrong object added in materialize. I removed that and it's fixed.
更多推荐
ROR与Salesforce错误:请求的资源不存在
发布评论