Tuesday, September 8th, 2009

Freezing gems (other than rails) on 2.3.4

Problem
Your host (ie dreamhost) for deploying applications doesn’t have the gems you are using in your development.
Solution
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:
rake gems:unpack

No Comments » - Posted in Dreamhost, ruby on rails by kosmas

Friday, September 4th, 2009

Rails XSS vulnerability

Problem
There was a warning about an XSS vulnerability in Ruby on Rails. More details can be found here.
Solution
Upgrade to the most recent (fixed) Rails version (2.3.4):
sudo gem install rails

1 Comment » - Posted in ruby on rails by kosmas

Thursday, January 8th, 2009

Phusion Passenger installation in Mandriva 2009

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

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)
Use the details from the phusion passenger website. ie:
Install passenger:
gem install passenger

Run the passenger installation:
passenger-install-apache2-module

If at the second stage [...]

1 Comment » - Posted in Mandriva, ruby on rails by kosmas

Tuesday, November 25th, 2008

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

No Comments » - Posted in ruby on rails by kosmas

Wednesday, May 28th, 2008

Rails 2 new ways

Problem
To get used to the new ways of working with Rails 2.
Solution
Here are some of the new ways of doing things in Rails 2.

Create a scaffold and migration on one step:
./script/generate scaffold product fied1_name:string field2_name:string field3_name:float
Make sure that you don’t have any previous migration(ie manually created) for the same model, as the generator [...]

No Comments » - Posted in ruby on rails by kosmas