Have you ever deployed a Rails application via Phusion Passenger and received this error?
Error message: no such file to load -- application (MissingSourceFile) Exception class: Passenger::UnknownError
I did, and found very little documentation about it. Luckily, this post on the Slicehost forum tipped me off to the solution. Remember back in Rails 2.3, when application.rb was renamed to application_controller.rb?
Well it turns out that the version of Passenger installed on my remote host was still looking for application.rb. I didn't have control over the host, so instead I added the following line to my Capistrano deploy.rb file, in the :deploy namespace.
namespace :deploy do
task :restart, :roles => :app, :except => { :no_release => true } do
# symlink application.rb to application_controller.rb
run "#{try_sudo} ln -s #{File.join(current_path,'app','controllers','application_controller.rb')} #{File.join(current_path,'app','controllers','application.rb')}"
end
end
Now whenever I run cap deploy, a symlink is created from application.rb to application_controller.rb. For you non-linux users, this means that whenever Passenger tries to access application.rb it will automatically access application_controller.rb.
I hope this saves you some hours of frustration!
Darren Allen is the President of White Dog Design Group, where he leads a talented group of designers passionate about engaging users on the web. Darren loves the space where great design and business strategy meet. Where clients succeed because the message, the branding, and the online strategy are all working together with clarity and focus. When he isn't pushing pixels, Darren is probably out somewhere training for a triathlon, or spending time with his uber-cool family.