I have been beating my head against the wall for about 6 months trying to figure this out. Here is the step by step process that I used to convert this lead. I am assuming that you already have ActiveSalesforce installed and useable. Please see the examples at ActiveSalesforce to learn how to set it up.
Create a model called lead.rb in your app/models folder and put the following line into the body of the class (assuming your database.yml file has a sf_development and an sf_production configured:
Lead.establish_connection(YAML.load(File.open(File.join(RAILS_ROOT, "config/database.yml"),"r"))["sf_#{ENV['RAILS_ENV']}"])
Now run your console with script/console. Here's where I had a lot of questions and was not able to figure it out. First of all, make sure you are able to get a lead by typing
lead = Lead.find(:first)
If you get results, then we're good so far. I found out that you can access the binding directly from the Lead object by doing the following:
Lead.connection.binding
You will need to use this to convert the lead. Now that you have a lead object, do the following:
leadConvert = {"leadConverts" => {"accountId" => nil, "leadId" => lead.id.slice(0,15), "contactId" => nil, "overwriteLeadSource" => false, "doNotCreateOpportunity" => true, "opportunityName" => nil, "convertedStatus" => 'Converted', "sendNotificationEmail" => false }}
Note that the convertedStatus may be 'Qualified' or something else. You can find it by manually converting a lead on Salesforce and viewing what the convert status is. Next type:
convertedLeads = Lead.connection.binding.convertLead leadConvert
This will either return an error or the results which include a new accountId, contactId and opportunityId.
There you go. It was easier than I had thought.