#2 new
Sébastien Grosjean - ZenCocoon

Using validate_uniqueness_of on a translated attribute fails

Reported by Sébastien Grosjean - ZenCocoon | January 15th, 2009 @ 11:40 AM

When validating the uniqueness of a translated attributes it fails with :

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.text?

It actually makes the same kind of error if testing it with rspec 1.1.12 and rspec-on-rails-matchers :

Test :

it { should validate_uniqueness_of(:url) }

Error :

undefined method stub!' for #<Class:0x23b255c> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:inmethod_missing'

Hope that can help improving the fantastic Globalize2 !

Comments and changes to this ticket

  • cantorrodista (at gmail)

    cantorrodista (at gmail) January 26th, 2009 @ 07:07 PM

    I reproduced the same problem in my project.

    I think that the problem is in AR::Base method 'columns', that doesn´t found a column named with the attribute (the attribute is in other table, named model_translates)...

    Are there any solutions to fix it??

    I tried to rewrite the columns method, to return also the columns of the table named '*_translates', but other problems came...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The second incarnation of Globalize for Rails, which will let your Rails app speak any language on Earth, and beyond.

People watching this ticket

Pages