The talk I gave at yesterday’s Phoenix Rails meeting will be featured in Rubyology Podcast #48, courtesy of Chris Matthieu. Thanks for the effort and kind words! The Mugr.com demo portion at the end got cut out unfortunately, but the meat of the technical discussion is available for your listening pleasure.
Slides: Keynote PDF
Tag: ruby
-
Featured In Rubyology Podcast #48
-
Dynamically Generating SSL Certificates with Ruby on Rails
OpenRain had a couple projects recently need to programmatically generate private keys and SSL certificates in Ruby. To contribute back to the community, we’re releasing several small things today.
- SSLsicle.com A simple form which does the OpenSSL grunt work and pop outs an SSL certificate ready to use with Apache (or whatever). SSLsicle uses..
- eassl_fix A Rails plugin which patches a small but critical bug in the eassl v0.1.1643 gem which makes OpenSSL object manipulation a bit less dense. I’ve submitted a patch (included) to the author, but as of today he hasn’t applied it. (Also, props to the JumpBox guys.)
If you need to write your own code to generate SSL certificates in Rails..
- sudo gem install eassl
- Install the eassl_fix plugin
- Bust out a view for the user to enter the information that gets baked into the cert and then write a few lines in your controller…
require 'eassl' key = Key.new options = { :country => params[:csr][:country], :state => params[:csr][:state], :city => params[:csr][:city], :organization => params[:csr][:organization], :department => params[:csr][:department], :common_name => params[:csr][:common_name], :email => params[:csr][:email] } name = CertificateName.new(options) csr = SigningRequest.new(:name => name, :key => key) ca = CertificateAuthority.new(:password => nil) cert = ca.create_certificate csr @pem = key.private_key.to_s @pem += cert.to_pem
- @pem.to_s will contain an unencrypted private key as well as a signed certificate suitable for deployment.
-
OS X Ruby Troubleshooting: "command not found: dot"
If you’re trying to run rdoc but are getting errors like..
Generating HTML…
Diagrams: ./opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27: command not found: dot -Tismap dot/f_0.dot
./opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27: command not found: dot -Tismap dot/f_1.dot..the package you need to install is called graphviz. You can install it using Darwin Ports on OS X like so..
sudo port install graphviz
-
5 Roadblocks To Enterprise Rails Acceptance
I love Rails for its pragmatic design and agile culture: two qualities not usually associated with the large, enterprisey systems of Fortune 500 companies. In my last formal position I was part of a small internal movement to drive the Rails train upward through the IT ranks, but the effort was met with limited success. The unfortunately reality is that Rails currently lacks several key qualities to which enterprise project leaders have become accustomed. Here are five reasons of varying significance to start us off.
Insane Query Support
Most documentation you read about ActiveRecord will take you through tidy, minimalistic examples which are squeaky clean and really fast. Complex queries, however, will be easier to do using Model.find_by_sql, which accepts a raw SQL query. Ordinary dynamic finds with deep loading behavior may require you to hard-code names in the query to avoid issues with the generated SQL. ActiveRecord is way easier to use, but far from Hibernate. I’d say that over 95% of the queries issued by a larger application are of trivial or medium complexity, but a lot of time and your best developers go into that last 5%, and this is where the heavier OR/M frameworks start looking better than ActiveRecord.
Distributed Transactions
The rise in SOA interest over the last couple years has led to more applications using multiple data sources. While it is possible to nest transactions, “Rails doesn’t support distributed two-phase commits (which is the jargon term for the protocol that lets databases synchronize with each other).” (From Agile Development with Rails, 2nd Edition.) In many situations, simply nesting transactions will suffice; however, many situations should really have the safely and reliability of two-phase semantics, and this factor alone could be a deal breaker.
Data Integrity
Database Designers (DBDs) like FOREIGN KEY constraints, CHECKs, high levels of normalization, and are the natural enemy of null fields. In other words, DBDs don’t like Rails. While I’m certainly no Pedantic Data Nazi (PDN?), there should at least be a basic set of built-in mechanisms for generating such simple self-defenses against naughty applications. Frankly I’m surprised that the community isn’t pushing harder for solid constraint support within migrations.
IDEs
This isn’t technically an issue with Rails itself, but a roadblock to its adoption nonetheless. Most Rails developers (including myself) appear to be using TextMate. A smaller population use RDT, Emacs, or numerous other packages. But there isn’t yet an application which comes close to the basic core feature of the popular Java and .Net IDEs. The currently broken breakpointer is another swift kick in the pants. What I can do with Eclipse on a remote application server isn’t in the same universe of functionality as the Rails breakpointer, even when it worked.
Top-Down Push
For whatever reason, CTOs and CIOs haven’t yet become seriously interested in Rails, and without this air of implicit exploratory approval, managers seem reluctant to give in to antsy developers. I would love to see Rails become a flagship of agile enterprise projects, but that’s not going to happen until management sees the real ROI of a project done by experienced Rails developers.
None of these things are insurmountable, but there are many more challenges to overcome if Rails will ever sit on the same application servers as Java and .Net. What challenges have you faced with Rails at your organization?
-
Fixing "wrong number of arguments" Error w/Rails 1.2.3 Upgrade
If you’ve just upgraded your Rails gem from 1.2.2 to 1.2.3 and are getting the following error on database hits..
wrong number of arguments (1 for 0)
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `initialize’..note that updating RAILS_GEM_VERSION in environment.rb appears to be required. Running a 1.2.2 application on 1.2.3 (even when 1.2.2 and all dependencies installed) will yield this error. Whatever.