phup 'n stuff

Another Blog About Being a Developer

Posts Tagged ‘Ruby on Rails’

Constraints in Rails Migrations

Thursday, January 22nd, 2009

I decided to try a rails project again… something I do quite frequently after I've completely forgotten everything I've learned.

One thing I quickly remembered is that there is no easy way in a migration to create constraints, like a foreign key. You have to do some exec silliness with an actual query.

After some quick searching, I found this plugin: http://rubyforge.org/projects/mig-constraints
(more…)

Windows -> Linux Path Problems

Sunday, October 22nd, 2006

I had one hell of a time when I copied my Ruby on Rails application from my development machine (Windows XP, Apache 2.2) to my production machine (Linux, Apache 1.3). I floundered through a series of errors and problems, but one error really stumped me, and unfortunately I couldn't find much help on the net for it:

Application error (Rails)

It took me forever to get past this problem, but I finally figured it out. The first line of a few files in the public/ folder contained a path to the Ruby binaries.

#!C:/ruby/bin

For obvious reasons, this wasn't going to fly well on a *nix server. So I had to change it in the following files: dispatch.cgi, dispatch.fcgi, dispatch.rb.

In my instance, it was changed to:

#!/usr/local/bin/ruby

But obviously your server might be different. Try exploring /usr/local and /usr/bin or using locate ruby to try to find the correct path to Ruby.

After I made this modification the application worked fine.