Display salesforce.com account listing with Ruby on Rails
I would like to show you, how I did my first connection from Rails to salesforce.com. As an example I would like to display a listing of salesforce.com accounts on a web page.
Getting Started
Following the instructions on ActiveSalesforce (ASF) I installed ActiveSalesforce gem, created a Rails application and configured the application and database.
D:\projects>gem install activesalesforce --include-dependencies
D:\projects>rails sftest
D:\projects>cd sftest
Edit D:\projects\sftest\config\environment.rb and add the line require_gem 'activesalesforce'. If you forget to require the gem you will get an error message: database configuration specifies nonexistent activesalesforce adapter (ActiveRecord::AdapterNotFound).
Edit D:\projects\sftest\config\database.yml and add your salesforce.com account information.
adapter: activesalesforce
url: https://www.salesforce.com/services/Soap/u/7.0
username: salesforce-username
password: salesforce-passwordCreate module and controller.
D:\projects\sftest>ruby script/generate model account
D:\projects\sftest>ruby script/generate controller account
Edit D:\projects\sftest\app\controllers\account_controller.rb.
class AccountController < ApplicationController
scaffold :account
endRun the server and watch the result in your browser.
D:\projects\sftest>ruby sript/server

Resources
technorati tags:rubyonrails, rails, activesalesforce, salesforce
