function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JMcCleeryJMcCleery 

Master-Detail and Lookup Relationships in Ruby

I've recently started using the Salesforce Ruby Toolkit, and have been able to successfully list and update objects. A lot of my custom objects have lookup relationships or Master-Detail relationships. When it has one of these, I'm unable to create a new object because of the extra "_id" that it adds to the sfdc field name. Ex: field is named MyBoss__c, ruby toolkit names it myboss_id__c.  When it tries to insert the object, it says "Required fields are missing: [MyBoss__c]".

 

Has anyone had this same problem? If so, how did you get around it?

 

I'm using Ruby 1.8.7, Rails 2.2.2, asf-soap-adapter 1.3.1, facets 2.8.4

Also installed: rforce 0.7, & rforcedotcom 20.0.0

 

Application Trace:

 C:/Ruby187/lib/ruby/gems/1.8/gems/asf-soap-adapter-1.3.1/lib/active_record/connection_adapters/activesalesforce_adapter.rb:265:in 'send_commands'
C:/Ruby187/lib/ruby/gems/1.8/gems/asf-soap-adapter-1.3.1/lib/active_record/connection_adapters/activesalesforce_adapter.rb:297:in 'commit_db_transaction'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:78:in 'transaction_without_nesting_support'
C:/Ruby187/lib/ruby/gems/1.8/gems/asf-soap-adapter-1.3.1/lib/active_record/connection_adapters/activesalesforce_adapter.rb:221:in 'transaction'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in 'transaction'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in 'transaction'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:178:in 'with_transaction_returning_status'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in 'save'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:158:in 'rollback_active_record_state!'
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in 'save'
app/controllers/salesforce/buildings_controller.rb:48:in 'create'
app/controllers/salesforce/buildings_controller.rb:47:in 'create'

apexsutherlandapexsutherland

Hi JMcCleery,

 

Unfortunately the online resources aren't entirely clear - the Force.com Toolkit for Ruby is no longer actively supported by the community, as a new gem has been released by Salesforce.com & Heroku for integrating Ruby apps with Force.com:

 

http://blogs.developerforce.com/developer-relations/2011/08/new-force-com-and-database-com-ruby-gem-now-available.html

 

Please join our ActiveSalesforce Google Group, where you can get support from the community that used to maintain the ActiveSalesforce gem and is now transitioning to support the new databasedotcom gem:

 

http://groups.google.com/group/activesalesforce/