Tag Archives: rails

SQL Logging to script/console

When running a Rails console session, a true time saver is directing the ActiveRecord logs to STDOUT instead of the log file.  This is easily accomplished adding the following to your ~/.irbrc file: if rails_env = ENV[’RAILS_ENV’] # Called after … Continue reading

Posted in Technology | Tagged , , , | Leave a comment

Error Handling with XML and Authlogic

I was helping a friend integrate an API into the application. He is running Rails 2.3.4 with Authlogic. His authentication check method was the following: 1 2 3 4 5 6 7 8 def require_user unless current_user session[:return_to] = request.request_uri … Continue reading

Posted in Technology | Tagged , , , | 1 Comment

Capistrano – Deploying a Branch

When deploying from Capistrano, I like to have the following in my ‘deploy.rb’ file: set :scm, "git" set :repository, "git@www.example.com:project.git" set :git_shallow_clone, 1 set :deploy_via, :remote_cache This allows speeds deployments by keeping a versions checked out on the server in … Continue reading

Posted in Technology | Tagged , , , , | 2 Comments

Capistrano – Email on Deployment

It’s a good practice to send a notification to certain people when a new version is deployed. This process can easily be automated in Capistrano. Add the following file to the ‘lib’ directory with the filename ‘cap_mailer.rb’: 1 2 3 … Continue reading

Posted in Technology | Tagged , , | 1 Comment

Capistrano – Install Gems Remotely

Capistrano does not have out-of-the-box support for installing gems on your servers. You may not need this if you are packing them, but some of us would like to run the equivalent of ‘rake gems:install’. To do this in capistrano, … Continue reading

Posted in Technology | Tagged , , , | Leave a comment

Capistrano – Adding Help to Deployments

If you don’t do something everyday, you tend to forget how to do it. The same is with the deployments. To help this, you can easily add a help section to Capistrano in your ‘config/deploy.rb’ file. Here is a sample: … Continue reading

Posted in Technology | Tagged , , | Leave a comment

Capistrano – Multiple Environments

Capistrano is designed to deploy your Rails application (yes it can handle others, but more work is required) to production.  However, most applications need to be deployed to more than one environment.  For example, we deploy to a staging environment … Continue reading

Posted in Technology | Tagged , , | Leave a comment

Update: Fixing Rails in Snow Leopard

I was too quick to declare success in my update to Snow Leopard earlier this week.  As it turns out, much of my recovered space came from Xcode being uninstalled.  Easy fix.  Grabbed the DVD and installed it in a … Continue reading

Posted in Technology | Tagged , , , , , , , | 3 Comments

Capistrano is Fixed in Snow Leopard

There were a number of things that seemed to break with the upgrade to Snow Leopard.  The latest is my ability to deploy Rails application using Capistrano.  For some reason, the SSH connection would hang.  Looks like this was fixed … Continue reading

Posted in Technology | Tagged , , , , | Leave a comment