GLoc Validation Problems After Rails 2.1 Upgrade

by on August 28, 2008 · 1 comment

When upgrading our application from Ruby on Rails 1.2.6 to Rails 2.1 we experienced some issues with the GLoc localization library.

First, we got exceptions like this one:

ActionView::TemplateError (wrong number of arguments (3 for 2))

Thanks to this Rails 2.1 patch for GLoc, we were able to run our application again.

But then we noticed the application threw exceptions on some validations. Here is such an exception:

NoMethodError (undefined method `%' for :error_invalid:Symbol):
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:695:in `validates_format_of'

As a workaround to solve the above exceptions, we added custom messages to the following validations:

validates_inclusion_of ..., :message => l(:incl_key)
validates_exclustion_of ..., :message => l(:excl_key)
validates_format_of ..., :message => l(:form_key)

Now, GLoc seems to work with Rails 2.1!

Did you enjoy this article? Get new articles for free by email:



Related Posts

{ 1 comment… read it below or add one }

MonkeyPatcher October 1, 2008 at 12:08 am

The good old Ruby on Rails “plugins”. Wait. Do they really call them plugins? Just patching framework classes at will doesn’t make this piece of code a plugin, does it? Long live the Monkey Patcher!!!

Reply

Leave a Comment