• 41Falls
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi everyone, Tried to test the integration between Salesforce.com and Ruby on Rails 3.0.3 (rubygem 1.5, ruby 1.9.2)
Content of database.yml (with proper credentials erased)
development:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: ######
    password: ######
    api_version: 20.0
test:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0
production:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0
    
salesforce-default-realm:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0

Then content of the gemfile file
...
gem 'rails', '3.0.3'

gem 'asf-soap-adapter', :require =>'activerecord-activesalesforce-adapter'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'

....
Runned a bundle install against this file, then a
rails generate model Salesforce::Contact
to get access to a standard SFDC object
When I try to use the console : rails console Everything load fine, no error and then when I type
Salesforce::Contact.first
After few seconds I get this error. Any clue ?
irb(main):015:0> Salesforce::Contact.first
ActiveSalesforce::ASFError: INVALID_TYPE: sObject type 'SalesforceContact__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:665:in `get_result'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:713:in `rescue in get_entity_def'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:706:in `get_entity_def'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:868:in `lookup'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:329:in `select_all'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation.rb:64:in `to_a'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:333:in `find_first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:122:in `first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:439:in `first'
from (irb):15
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Tried also with a custom object called Test1, generated also the model and I get this
irb(main):016:0> Salesforce::Test1.first
ActiveSalesforce::ASFError: MALFORMED_QUERY: \nSELECT  Test1__c.* FROM Test1__c LIMIT 1\n                ^\nERROR at Row:1:Column:17\nunexpected token: '*'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:665:in `get_result'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:384:in `select_all'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation.rb:64:in `to_a'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:333:in `find_first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:122:in `first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:439:in `first'
from (irb):16
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Thanks in advance
For information here is the list of gems when I try to list them, what is weird is that I can't see the activerecord-activesalesforce-adapter gem even though it is listed in the Gemfile
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.24) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.15) 
Using actionmailer (3.0.3) 
Using arel (2.0.7) 
Using activerecord (3.0.3) 
Using activeresource (3.0.3) 
Using facets (2.8.4) 
Using hpricot (0.8.3) 
Using oauth (0.4.4) 
Using rforce (0.6) 
Using asf-soap-adapter (1.1.0) 
Using bundler (1.0.10) 
Using thor (0.14.6) 
Using railties (3.0.3) 
Using rails (3.0.3) 
Using sqlite3 (1.3.3) 
Using sqlite3-ruby (1.3.3) 
Hi everyone, Tried to test the integration between Salesforce.com and Ruby on Rails 3.0.3 (rubygem 1.5, ruby 1.9.2)
Content of database.yml (with proper credentials erased)
development:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: ######
    password: ######
    api_version: 20.0
test:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0
production:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0
    
salesforce-default-realm:
    adapter: activesalesforce
    url: https://www.salesforce.com
    username: #####
    password: #####
    api_version: 20.0

Then content of the gemfile file
...
gem 'rails', '3.0.3'

gem 'asf-soap-adapter', :require =>'activerecord-activesalesforce-adapter'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'

....
Runned a bundle install against this file, then a
rails generate model Salesforce::Contact
to get access to a standard SFDC object
When I try to use the console : rails console Everything load fine, no error and then when I type
Salesforce::Contact.first
After few seconds I get this error. Any clue ?
irb(main):015:0> Salesforce::Contact.first
ActiveSalesforce::ASFError: INVALID_TYPE: sObject type 'SalesforceContact__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:665:in `get_result'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:713:in `rescue in get_entity_def'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:706:in `get_entity_def'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:868:in `lookup'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:329:in `select_all'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation.rb:64:in `to_a'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:333:in `find_first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:122:in `first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:439:in `first'
from (irb):15
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Tried also with a custom object called Test1, generated also the model and I get this
irb(main):016:0> Salesforce::Test1.first
ActiveSalesforce::ASFError: MALFORMED_QUERY: \nSELECT  Test1__c.* FROM Test1__c LIMIT 1\n                ^\nERROR at Row:1:Column:17\nunexpected token: '*'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:665:in `get_result'
from /usr/local/lib/ruby/gems/1.9.1/gems/asf-soap-adapter-1.1.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:384:in `select_all'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:467:in `find_by_sql'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation.rb:64:in `to_a'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:333:in `find_first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/relation/finder_methods.rb:122:in `first'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/base.rb:439:in `first'
from (irb):16
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Thanks in advance
For information here is the list of gems when I try to list them, what is weird is that I can't see the activerecord-activesalesforce-adapter gem even though it is listed in the Gemfile
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.24) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.15) 
Using actionmailer (3.0.3) 
Using arel (2.0.7) 
Using activerecord (3.0.3) 
Using activeresource (3.0.3) 
Using facets (2.8.4) 
Using hpricot (0.8.3) 
Using oauth (0.4.4) 
Using rforce (0.6) 
Using asf-soap-adapter (1.1.0) 
Using bundler (1.0.10) 
Using thor (0.14.6) 
Using railties (3.0.3) 
Using rails (3.0.3) 
Using sqlite3 (1.3.3) 
Using sqlite3-ruby (1.3.3)