Posts Tagged ‘Rails’

Error when trying to deploy Rails 3 application with ActiveAdmin

I have just tried to deploy my Rails 3 application which uses ActiveAdmin and I’ve gotten the following error:

File to import not found or unreadable: active_admin/mixins

(more…)

`require’: no such file to load — readline (LoadError)

I got the following error when trying to start the ‘rails console’ in a Rails3/Ruby 1.9.2 project:

`require’: no such file to load — readline (LoadError)

The problem was that readline was not installed properly. To install it, I needed to go into the ruby sources. In my case they were located in the directory /use/local/src/ruby-1.9.2-p0/ext/readline. I changed to it an built and installed realdline via

ruby extconf.rb
make
sudo make install

Autoload modules in Rails 3

In Rails 3 the modules in lib/ are not loaded automatically. You need to a a one liner to the application.rb:

config.autoload_paths += %W(#{config.root}/lib)

xss_terminate – protect your Ruby on Rails code from XSS

Just found this little plugin which is maybe interesting to protect against Cross-site scripting in Ruby on Rails.

xss_terminate is a plugin in that makes stripping and sanitizing HTML stupid-simple. Install and forget. And forget about forgetting to h your output, because you won‘t need to anymore.

via xssterminate – Project Hosting on Google Code.

Running rake tasks in different environments

To run Rake tasks with Ruby on Rails in different environments, you just provide the necessary variable when starting the task:

$ RAILS_ENV=staging rake db:migrate

In this case we are starting the migration tasks in an environment called staging. You can of course also provide the standard environments like development, test or production.