1

I am attempting to use the databasedotcom and databasedotcom-rails gems as part of an app I'm building in ruby on rails and for some reason I am getting an error when attempting to update custom salesforce objects. Everything works just fine on default objects such as users or leads, it's only the custom objects. I've checked and the custom objects are updateable and I have permissions to update them. I've even been able to update the custom objects through IRB. It's only in the rails app that I encounter problems.

I get this error:

NoMethodError in PilotsController#update
undefined method `each' for nil:NilClass

On the first line inside of this method:

  def update
    @pilot.update_attributes Pilot__c.coerce_params(params[:pilot])
    flash[:info] = "The Pilot was updated!"
    redirect_to pilot_path(@pilot.Id)
  end

When comparing the output for both the custom and the default objects I believe that all is the same up until the point when the default object process sends out a request to update the record with a parameters hash of the updated information. This is where the custom object process errors out.

Custom object output:

Started PATCH "/pilots/a0EG000000lEARoMAO" for 127.0.0.1 at 2014-03-29 10:13:46 -0400
Started PATCH "/pilots/a0EG000000lEARoMAO" for 127.0.0.1 at 2014-03-29 10:13:46 -0400
Processing by PilotsController#update as HTML
Processing by PilotsController#update as HTML
Parameters: {"utf8"=>"✓",     "authenticity_token"=>"AUTH TOKEN REMOVED INTENTIONALLY FOR THIS QUESTION", "pilot__c"=>  {"Name"=>"Jared dsfd"}, "commit"=>"Update Pilot  c", "id"=>"a0EG000000lEARoMAO"}
Parameters: {"utf8"=>"✓", "authenticity_token"=>"AUTH TOKEN REMOVED INTENTIONALLY FOR THIS QUESTION", "pilot__c"=>{"Name"=>"Jared dsfd"}, "commit"=>"Update Pilot  c", "id"=>"a0EG000000lEARoMAO"}
***** REQUEST:   https://na11.salesforce.com/services/data/v22.0/sobjects/Pilot__c/a0EG000000lEARoMAO
***** RESPONSE: Net::HTTPOK -> {"attributes": OBJECT ATTRIBUTES REMOVED INTENTIONALLY FOR THIS  QUESTION }
Completed 500 Internal Server Error in 2008ms
Completed 500 Internal Server Error in 2008ms

NoMethodError (undefined method `each' for nil:NilClass):
app/controllers/pilots_controller.rb:19:in `update'

NoMethodError (undefined method `each' for nil:NilClass):
app/controllers/pilots_controller.rb:19:in `update'

Default object output:

Started PATCH "/users/005G0000003VLJCIA4" for 127.0.0.1 at 2014-03-29 10:15:15 -0400
Started PATCH "/users/005G0000003VLJCIA4" for 127.0.0.1 at 2014-03-29 10:15:15 -0400
Processing by UsersController#update as HTML 
Processing by UsersController#update as HTML
Parameters: {"utf8"=>"✓",  "authenticity_token"=>"AUTH TOKEN REMOVED INTENTIONALLY FOR THIS QUESTION", "user"=> {"FirstName"=>"Dana", "LastName"=>"T", "CompanyName"=>"TEST Application"},  "commit"=>"Update User", "id"=>"005G0000003VLJCIA4"}
Parameters: {"utf8"=>"✓", "authenticity_token"=>"AUTH TOKEN REMOVED INTENTIONALLY FOR THIS QUESTION", "user"=>{"FirstName"=>"Dana", "LastName"=>"T", "CompanyName"=>"TEST Application"},  "commit"=>"Update User", "id"=>"005G0000003VLJCIA4"}
***** REQUEST:   https://na11.salesforce.com/services/data/v22.0/sobjects/User/005G0000003VLJCIA4
***** RESPONSE: Net::HTTPOK -> {"attributes":{OBJECT ATTRIBUTES REMOVED INTENTIONALLY THIS QUESTION}
******* REQUEST:  https://na11.salesforce.com/services/data/v22.0/sobjects/User/005G0000003VLJCIA4 =>  {"FirstName":"Dana","LastName":"T","CompanyName":"TEST Application"}**
***** RESPONSE: Net::HTTPNoContent -> 

Any insight into a solution to this problem would be greatly, greatly appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.