+ Start a Discussion
Anil DuttAnil Dutt 

ROR error with Salesforce: The requested resource does not exist

HI,

 

i m using Ruby Gem "Databascdotcom" to integrate Salesforce in ROR and all works fine.

But getting following error on first call to salesfroce

**The requested resource does not exist**

If i refresh(Ctrl + F5) page again , it work 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.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   

On first call to "SalesForceFeed" return error "The requested resource does not exist", so add a excepton check and call "SalesForceFeed" again, but i know this is not the right way.

So please suggest me a better way to fix this
Thanks