After the announcements in the previous posts about the security vulnerabilities in Rails 3.0.3, you would like to update your application and deploy with the latest 3.0.4 version.
- Change your Gemfile to replace
gem 'rails', '3.0.3'
gem 'rails', '3.0.4'
bundle update rails
- Remove the old gems by using:
git rm name_of_3.0.3_gem
- Add the new gems to your git
git add vendor/cache
- Check in to your repository the new files
git commit vendor/cache -m 'upgrade to rails 3.0.4'
- Make sure that you also check in both your Gemfile and Gemfile.lock into your git repository
git commit Gemfile Gemfile.lock -m 'update Gemfiles to use 3.0.4'
otherwise when you try to deploy you will see the error:
You have modified your Gemfile in development but did not check the resulting snapshot (Gemfile.lock) into version control
- push everything to your git repository:
- Deploy your application with capistrano as usual:
- Your new gems for 3.0.4 should be installed on the share/bundle folder
When you try to run the console
rails c in a new Rails 3.0.3 application, and when you use rvm, you get the following error:
no such file to load -- readline (LoadError)
It’s quite like likely that the readline libraries are missing from your installation. To find out which ones go to the directory that the error is indicating (ie):
and then to the following:
then run the following:
If you get something like:
checking for readline/readline.h... no
checking for editline/readline.h... no
then you are probably missing the neccessary header files for readline.
so install them in your system (ie in Mandriva):
sudo urpmi readline-dev,
In Debian you will need to install libreadline5-dev and maybe libncurses5-dev (apt-get install).
When the package is installed successfully run the following again:
sudo make install
You should now be able to go back to your project and run
rails c with no errors.
When using Cucumber and Webrat in a ruby on rails 3 application you see the error:
undefined method `visit' for #<:rails::world:0x..fdb6d16e4> (NoMethodError) and your scenario fails.
Replace the line:
config.mode = :rails
with the line:
config.mode = :rack
in the Webrat.configure block, in your
You would like to start using BDD in a new Ruby on Rails 3 application, and would like to install Webrat, Cucumber and RSpec to your project.
Follow the steps below (taken from the RSpec Book), for creating a new Rails 3 application and adding the necessary testing frameworks:
- Create your new ruby on rails application:
rails new my_app
- Go to your new application directory:
- Edit your Gemfile to include the following:
group :development, :test do
gem "rspec-rails", ">= 2.0.0"
gem "cucumber-rails", ">= 0.3.2"
gem "webrat", ">= 0.7.2"
- Use bundler to install all the gems and dependencies:
- Install the rspec files:
script/rails generate rspec:install
- Install the cucumber files:
script/rails generate cucumber:install
- Run the following and you shouldn’t be seeing any errors: