Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:03:47+00:00 2026-06-07T16:03:47+00:00

I am using the Ruby Gem Databasedotcom to integrate Salesforce in a Rails app

  • 0

I am using the Ruby Gem “Databasedotcom” to integrate Salesforce in a Rails app and all works fine, but I now facing a problem with the same object name in the Rails application and Salesforce.

I have a User model in my Rails application and User object is also in Salesforce. So when trying to get data from Salesforce User object it always return the Rails application User object.

Here is my code

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("User");

@user = User.find_by_Id('005d0000001291x');

but above statement always use the User model from Rails.

I want to use the Salesforce User object to get its data.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:03:49+00:00Added an answer on June 7, 2026 at 4:03 pm

    At first wrap up you SF code in a module like this:

    module SF
      module Connection          
        def self.client
          @client = Databasedotcom::Client.new("config/salesforce.yml")
          @client.authenticate :username => SF_CONFIG['username'], :password => SF_CONFIG['password_with_token']
          @client
        end
      end
    end
    

    And create initializer where you specify module to use with sobject_module param:

    config/salesforce.yml:

    username: username
    password_with_token: token
    client_secret: secret
    client_id: cliend_id
    sobject_module : SF
    

    Add initializer to config/initializers:

    salesforce.rb:

    SF_CONFIG = YAML.load_file('config/salesforce.yml') rescue nil
    

    Now you can use User inside SF module and it will be SF User, not you AR one.

    And also I highly recommend you to read the documentation, there are quite a lot methods that will help you make your SF code cleaner:
    http://rubydoc.info/github/heroku/databasedotcom/master/frames

    Good luck with SF!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using the ruby-bitly gem to shorten links in a Rails app; however,
I'm using the Ruby Money gem in a multi-tenant (SaaS) Rails app, and am
I've been using the LinkedIn Ruby Gem and having a problem. Here is the
Using Ruby 1.8.7-p358, Rails 3.0.12, gem responder, gem simple-form; jquery_ujs.js I have a form
I am using Ruby on Rails 3.2.2 and I am experimenting the Squeel gem.
I am using Ruby on Rails 3.2.2 and Cucumber with the cucumber-rails gem. I
Using Ruby on Rails, if I do a gem help install a part of
I'm using Ruby 1.9 and Rails 2.3.4 with Paperclip gem to save attachments. and
I have been using Ruby 1.8 + Rails 2.3.5 with oracle_enhanced and it works
Am using Ruby on Rails and aws/s3 gem to upload files. Somewhere I read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.