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
NBlasgenNBlasgen 

Ruby on Rails: Is a Web Tab possible?

I've worked with PHP for years and the PHP process is easy.  I'm migrating my app over to Ruby on Rails, expecting that I can support all the things I expected with PHP but at least I can't find any documentation to support that.

So simple question, via a Web Tab I can pass Session ID and Partner API URL.  Can this at all be used with the Ruby Gem designed by Salesforce way back in 2011?

Salesforce, with their ownership of Ruby on Rails site Heroku doesn't have any documentation about how to connect with an application knowing the Session ID.  My VisualForce code, as far as I can tell, wouldn't be able to authenicate the user with the remote Ruby on Rails server either since there's no way to use OAuth via Visual Force, though I can get Session ID and Partner URL via Visual Force.
Best Answer chosen by NBlasgen
NBlasgenNBlasgen
Wow, I solved it myself.  It seems, and this isn't documented!!, that the OAuth token is the same as the Session ID.  2 days of messing around finally figured this out.

class HomeController < ApplicationController
        def create
                @session_id = salesforce_params[ :sid ]
                location_split = salesforce_params[ :url ].split("/")
                @location = "http://" + location_split[2]     

                client = Databasedotcom::Client.new                    
                client.authenticate :token => @session_id, :instance_url => @location
                render :text => client.list_sobjects
        end

        private def salesforce_params
                params.permit( :sid, :url )
        end
end

All Answers

Gaurav NirwalGaurav Nirwal
gem 'resque', '~> 1.25.2', require: 'resque/server'
gem 'resque-scheduler', '~> 2.5.5'
gem 'resque-web', require: 'resque_web'
Gaurav NirwalGaurav Nirwal
require 'resque'
Resque.redis = "127.0.0.1:6379" # tell Resque where redis lives
# This will "normally" make the tabs show up.
require 'resque_scheduler' # the one provided on the README doesn't exist 'resque-scheduler'
require 'resque_scheduler/server' # the one provided on the README doesn't exist 'resque/scheduler/server'
NBlasgenNBlasgen
I appreciate the response, but what does REDIS (the database) have to do with the difference between PHP's SOAP calls and Ruby's oAuth limitations?  The question is how to use Session ID rather than oAuth.
NBlasgenNBlasgen
Wow, I solved it myself.  It seems, and this isn't documented!!, that the OAuth token is the same as the Session ID.  2 days of messing around finally figured this out.

class HomeController < ApplicationController
        def create
                @session_id = salesforce_params[ :sid ]
                location_split = salesforce_params[ :url ].split("/")
                @location = "http://" + location_split[2]     

                client = Databasedotcom::Client.new                    
                client.authenticate :token => @session_id, :instance_url => @location
                render :text => client.list_sobjects
        end

        private def salesforce_params
                params.permit( :sid, :url )
        end
end

This was selected as the best answer