Author Archives: peter

Rails I18n and 404/500 Error Pages

If you have a multilingual site it makes sense for your 404 and 500 error pages to be multilingual as well. Rails supports multilinguality by serving up error pages with a path like public/500.sv.html, where sv is the locale. In … Continue reading

Posted by 6 Comments Posted in Ruby on Rails, Services

Rails Development Database Setup Without Migrations

I think a lot of Rails developers have been using the db:migrate Rake task to setup new development databases. The problem with this is that over time migrations tend to grow out of sync with the code, especially if you … Continue reading

Posted by 1 Comment Posted in Ruby on Rails Tagged

Rails bug fix: ActiveRecord::Base#exists? now compatible with include scopes

I was using a default scope for a model with :include and rder options and ran into an issue with the exists? method. We have now refactored the exists? method to invoke find_initial which handles scopes correctly. Thanks Michael for … Continue reading

Posted by Leave a comment Posted in Ruby on Rails

Rails Gotcha: Global Methods can Cause ActiveRecord Attribute Methods to Never be Defined

I just ran into a sort of edge case gotcha in the interaction between the acts_as_taggable_on Rails plugin and RSpec. It turns out both libraries define a context method. In the RSpec case it is a global method (defined in … Continue reading

Posted by Leave a comment Posted in Ruby on Rails

Rails Gotcha: Eager Loading Application Classes to Make STI Work

Recent versions of Rails (2.2 and later I think) will eager load all application Ruby classes when booting up the server. However, because of issues with migrations this is not done if you are executing a Rake task that depends … Continue reading

Posted by 2 Comments Posted in Ruby on Rails

New Rails Plugin to shell out with verbose error handling

I was annoyed with the fact that when you use Ruby backticks (i.e. `some_shell_command`) to shell out to an external program and the path to the program is wrong then no exception is raised. In addition, using system and backticks … Continue reading

Posted by 1 Comment Posted in Ruby on Rails

Upgrading to Rails 2.3

We just upgraded our app from Rails 2.2.2 to Rails 2.3.2 and were able to get all our tests passing after having ironed out a number of deprecations, upgraded a few plugins, and patched a few others. Here is an … Continue reading

Posted by 2 Comments Posted in Ruby on Rails

Rake Tasks for the Translate Plugin

We’ve added two Rake tasks to the Translate plugin. The lost_in_translation rake task helps find I18n keys in lookups in your code that are missing from your default locale YAML file (i.e. config/locales/sv.yml in our case). The merge_keys Rake task … Continue reading

Posted by Leave a comment Posted in Ruby on Rails Tagged , ,

Translate: New Rails I18n Plugin with a Nice Web UI

Here at Mynewsdesk we are in the midst of internationalizing a fairly big Ruby on Rails application. Sven Fuchs’s I18n Textmate bundle has been a great help in extracting thousands of texts away from our source code and into YAML … Continue reading

Posted by 41 Comments Posted in Ruby on Rails Tagged ,