Building Web Apps with Rails 2 - Plugins and Conventions I Use

Peter Marklund

Motivation and Background


Rails Source Code Version

Avoid external dependencies

Unpack gems that don't require c compilation under vendor/gems

Patches and Hacks

JavaScript Performance

Use javascript_include_tag(:all, :cache => true) in your application.html.erb so that JavaScript files are bundled in production for performance

Sessions and Authentication


Make models implement the to_s method



Routes, REST, actions and controllers

Skinny Controllers and Fat Models

MySQL Configuration / Failing Early

Use a Custom Environment for Staging

Create the file config/environments/staging.rb and add the db connection in config/database.yml

File Uploads

Use the attachment_fu plugin by Rick Olson. See Mike Clarks instructions.

HTML Validation and Link Checking

Use the HTML Test plugin to validate all the HTML your app produces and check for broken links, redirects, and forms.

Capistrano Tasks

Use RSpec with Less Mocking