globalize2
globalize2 copied to clipboard
reflect_on_all_validations ???
On the following line: you use the method 'reflect_on_all_validations' but this method is nowhere defined (besides a plugin but this isn't installed)
http://github.com/joshmh/globalize2/blob/master/lib/globalize/active_record.rb#L106
This breaks the named scope (and others) which call the method ModelClass.required_attributes.
I submitted a pull request which added support to set required_attributes. It was accepted, so you can set required_attributes and it should work without reflect_on_all_validations
still not working for me.
NameError: undefined local variable or method `reflect_on_all_validations' for #Class:0xb6cc11d4
btw, i had another issue. given i have model Post and this Post has 2 translations (:en, :'pt-BR') for "title" and I am on I18n.locale = 'en' by default.
p = Post.first(:include => :translations, :conditions => ["post_translations.locale = ?", 'en'])
p.name returns 'title'
p = Post.first(:include => :translations, :conditions => ["post_translations.locale = ?", 'pt-BR'])
p.name returns nil
why if i have both translations on my db? cant figure out it and need a help.
Have you set required attributes in your class? The patch was a method to set required_attributes so reflect_on_all_validations won't be called. self.required_attributes = [:name]
thx man!
even though, it is still not working for me.. such as: my I18n.locale is set to :'pt-BR' by default
p = Post.with_translations(:'pt-BR').first p.name returns OK in pt-BR, as it should.
p = Post.with_translations(:en).first p.name returns nil.. and I have both translations on my db.
if I do it hardcoded, such as: p = Post.first(:include => :translations, :conditions => ["post_translations.locale = 'en'"]) p.name returns nil again.
I cant find out my issue with this. thx for your help.