multilang-hstore
multilang-hstore copied to clipboard
validate all locales rather than specific locale
multilang :content, :required => [:en]
The above validation will validate all locales rather than just :en.
I think line70 is the reason why it happens
In active_record_extensions.rb#L70 # attribute presence validator if options[:required] == true or locale_required?(options[:required], locale) module_eval do validates_presence_of "#{attribute}_#{locale}" end end
I'm sorry, I don't understand, can you explain it differently?
Sorry about my poor english.
Here is my syntax class Sample < ActiveRecord::Base
multilang :content, :length => 500, :required => [:en]
validates :content, :any => true
end
When i try to create an instance of Sample Class, sample1 = Sample.create(content: {en: "last 4 digital number"}), i got errors @messages={:content_zh_HK=>["can't be blank"]}
I expect that it should just validate the presence of :en. However, it also validates the presence of :zh_HK.
You're right, can You send me a pull request with a fix? Please include a test
Sure, I am happy to help. I will try in this weekend.