It the new year again and time for resolutions. I made a resolution about a year ago to learn ruby. If you are looking for something to learn this year I would recommend ruby and here’s why:
- Salesforce.com bought Heroku for $220M
- Salesforce.com has been pushing “Open. Social. Mobile” for quite some time.
- Ruby is great for creating social and mobile apps with open source technologies.
I presented this topic today at our Appirio Continuing Education webinar and thought it might come in handy for others trying to learn ruby. In the video I use the Databasedotcom gem to build a small app that displays a list of accounts, the details for a selected account and then queries for accounts by keyword. I reference some links to help you get started with ruby and rails and I’ve added them after the video.
You can find the source code here.
Links Referenced in the Video
Railsnstaller (Windows)
Homebrew
Ruby Version Manager (RVM)
Rails Guides
Railscasts
Rails for Zombies
Code School
Try Ruby
Ruby on Rails Tutorial
Ruby on Rails Documentation
Databasedotcom gem
Building and Deploying Great Applications with Salesforce, Ruby, and Heroku (Dreamforce)







Awesome stuff as always Jeff. Thanks so much.
ReplyDeleteThanks Jeff - all the resources I was looking for! Love Rails for Zombies
ReplyDeleteGreat stuff.
ReplyDeleteI am having trouble accessing sf custom objects, can you give a quick pointer on how to do that?
Did you ever figure out your issue. I am also having trouble accessing sf custom objects.
DeleteOpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
app/controllers/accounts_controller.rb:6:in `index'
Any help is appreciated.
This comment has been removed by the author.
DeleteGreat post - invaluable as I was new to rails, SFDC, and heroku. Speaking of that last - the application as you've laid it out here is not deployable to heroku because of its reliance on the sqlite3 gem. How do you work around that?
ReplyDeleteI've since figured out that you've got to swap in usage of postgresql instead of sqlite3 to make heroku happy (per their getting started guides). It's unfortunate that this requirement seems to cascade down to the dev environment, though - I had to set up a postgres database which isn't really being used.
ReplyDeleteIt seems weird that the databasedotcom gem's reliance on ActiveRecord kind of forces you to have some kind of database defined, even though it's not touching it. Am I missing something?
Thanks for posting this.
ReplyDeleteI am having an issue connecting to sfdc.
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
app/controllers/accounts_controller.rb:6:in `index'
Has something changed since this was posted?
Any help is appreciated.
databasedotcom.yml -
ReplyDeleteclient_secret: client secret
client_id: client key
debugging: true
username: reuel3@gmail.com
password: password+token
host: login.salesforce.com
in salesforce remote access -
ReplyDeletecallback url - http://localhost:3000
contact email - my sfdc email
I'm currently using the databasedotcom gem as called for in this tutorial:
ReplyDeletehttp://techblog.appirio.com/2012/01/tutorial-getting-started-with-rails.html
Any idea on setup, either on salesforce or rails that I need to implement?
I have a databasedotcom.yml that looks like this:
host: login.salesforce.com
client_secret:
client_id:
debugging: true
username: reuel3@gmail.com
password:
There was really no other configuration suggested.
--------------
More info. This is what I get when trying to connect to sf.
I'm also using rails 3.2.3 now.
I'm begging for help!
Started GET "/" for 127.0.0.1 at 2012-05-14 13:48:11 -0400
Processing by AccountsController#index as HTML
Completed 500 Internal Server Error in 89ms
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server c
ertificate B: certificate verify failed):
app/controllers/accounts_controller.rb:6:in `index'
Rendered c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3
/lib/action_dispatch/middleware/templates/rescues/_trace.erb (4.0ms)
Rendered c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3
/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.0
ms)
Rendered c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3
/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues
/layout (279.0ms)
[2012-05-14 13:48:18] WARN Could not determine content-length of response body.
Set content-length of the response or set Response#chunked = true
You shouldn't need to use HTTPS as your callback. Try using http://localhost:[port] as your Remote Access callback.
ReplyDeleteI am/was using http://localhost:3000 in my Remote Access callback. . .
ReplyDeleteCan I configure so that I don't use https? :
***** REQUEST: https://login.salesforce.com//services/oauth2/token?grant_type=pa
ssword&client_id=[client key]&client_secret=[client secret]&username=reuel3@gmail.com&password=[password and token]
If I try to hit sf directly with the url above with http instead, it returns:
invalid_request
HTTPS required
Here are some instructions for setting up webrick: http://www.nearinfinity.com/blogs/chris_rohr/configuring_webrick_to_use_ssl.html
ReplyDeleteThanks for speaking slowly, but I've been through that already resulting in this error when I hit my server:
ReplyDelete[2012-05-21 15:40:05] ERROR OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 state=SSLv2/v3 read client hello A: http request
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/openssl/ssl-internal.rb:164:in `accept'
I get:
***** REQUEST: https://login.salesforce.com//services/oauth2/token?grant_type=pa
ssword&client_id=[client key]&client_secret=[client secret]&username=reuel3@gmail.com&password=[password and token]
when webrick is not configured.
Sorry that I can't help any further. I'm not sure how to troubleshoot this configuration.
ReplyDeleteI figured it out. I had to add this line to my databasedotcom.yml:
ReplyDeleteverify_mode: OpenSSL::SSL::VERIFY_NONE
It looks like starting with ruby 1.9.2, verify_mode defualts to VERIFY_PEER.
Some further explantion can be found here:
https://groups.google.com/group/activesalesforce/browse_thread/thread/40a06f8444bcada5/800c3487feb68...
Thanks to all who pitched in.