Phusion Passenger installation in Mandriva 2009

Problem
You have recently installed Mandriva 2009 and you want to install phusion passenger.

Solution

  1. First make sure that apache is installed. If it is not installed (default), do:
    urpmi apache

    On the selection question about the dependencies select option 1 (apache-prefork)

  2. Use the details from the phusion passenger website. ie:
    Install passenger:

    gem install passenger
  3. Run the passenger installation:
    passenger-install-apache2-module
  4. If at the second stage of the installation the installer complains that GNU C++ compiler … not found, install the gnu c++ compiler, with:
    urpmi gcc_c++
  5. Run the passenger installation (step 3) again. If at this stage the installer complains that Apache 2 development headers … not found, use:
    urpmi apache-devel
  6. Run passenger installer (step 3), once more. Now everything should be ok and the apache 2 module will be installed when the installer finishes.
  7. Restart the Apache webserver, and you should be able to add your Rails application. Use the following to deploy your application in /somewhere/public:
    <VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public
    </VirtualHost>

assert_difference and Rails 2.1.0

Problem
Trying to use the assert_difference with Rails 2.1.0 produces errors if trying to use it with the syntax of another rails version.

Solution
The correct syntax for using assert_difference with rails 2.1.0 is:

def test_should_create_user

assert_difference(User, :count, 1) do

user = create_user

assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"

end

end

undefined method `find_by_contents’ ,acts_as_ferret

Problem
When trying to use the acts_as_ferret plugin in a search page by using the find_by_contents method then the following error appears:

undefined method `find_by_contents'

Solution
It seems that the API of the plugin has changed, and the

find_by_contents

method should be replaced with the:

find_with_ferret

method

ERROR: While executing gem … (ArgumentError)

Problem
After a recent upgrade to a newer rails version the gem package manager seems to be broken. Everytime you try to use gem install gem_name, you get the following error:

ERROR:  While executing gem ... (Gem::GemNotFoundException)

Deleting the cached files as suggested in other posts results in the error:

ERROR:  While executing gem ... (ArgumentError)

Solution
As suggested here, you need to do:

gem install rubygems-update
update_rubygems

which should be updating the gem version to the latest one, ie 1.3.0

FBML Error (line 5): illegal tag “body” under “fb:canvas”

Problem
When trying to use facebooker according to the Developing facebook platform applications with rails book, in the network_test step you are getting the following error:

FBML Error (line 5): illegal tag "body" under "fb:canvas"

Solution
It should be caused because you are using the facebooker gem instead of the plugin.
Install the plugin:

ruby script/plugin install git://github.com/mmangino/facebooker.git

Running script/runner in production environment

Problem
Following from a previous post about email scheduling with runner and cron, it turns out that the runner default behaviour is to run in the development environment.

Solution
Although by reading the help for the script/runner, there is a suggestion to run it with the -e production added to the end, it doesn’t seem to be working.

The solution to make it running in the production environment was to delete the first line (shebang) from step 3 on this post

#!/usr/bin/env /path_to_your_app/script/runner

and then use the following in the cron setup:

RAILS_ENV=production /path/to/your_ror_project/script/runner /path/to/your_ror_project/lib/email_scheduler.rb

Have a look on paragraph Alternative Usage here

Dreamhost, Rails 2.1.1, Freeze, Capistrano

Problem
With the imminent upgrade in Dreamhost to Rails 2.1.1 (dreamhost blog post here), you may want to freeze your Rails version to a previous version, using capistrano.

Solution
On your local development pc freeze the rails:

rake rails:freeze:gems

Add the new code to your svn repository:

svn commit -m 'freeze rails'

And then deploy to dreamhost using capistrano:

cap deploy

Your rails project located on dreamhost should be frozen to your current Rails version.