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
RupRup 

Asf::AR::Mixin requires connection [cross-posted from RubyForge/Asf]

I would like to define
  Code:
class MyContact < ActiveRecord::Base
include ActiveSalesforce::ActiveRecord::Mixin
set_table_name("Contact")
end

 but to do this, I need to be connected to salesforce.com *before* including the set_table_name (or set_table_name connects automatically).

What I need is to be able to set up my classes, and *then* to initiate connection(s). Especially in a test rig where connecting to salesforce.com is part of the tested methods, in which I would like to use pre-recorded test results for offline testing, just as Asf is unit-tested.

Would it be possible to postpone connection in set_table_name to later ?


Doug ChasmanDoug Chasman
We would need to make login "lazy" instead of eager - we should be able to accomplish this by changing the rforce connection to perform a lazy login (login() just stores the auth info but does not attempt to make an sfdc WS call) that only attempts login on the first actual invokation of call_remote().

I'll take a look - have been focused on a couple of other issues (e.g. gem changes that just do not seem to work as advertised).