-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
First off: Thank you for all your efforts! I really enjoy working with Mongoid!
I'd like validation conditions to be evaluated for each locale. For example:
class Model
include Mongoid::Document
field :enabled, type: Boolean, localize: true
field :title, type: String, localize: true
validates_presence_of :title, if: :enabled
end
Currently the condition is run only once. The value for enabled is determined by I18n.locale. It's therefore very hard to have locale context aware conditions.
I thought about looping through the locale versions and changing I18n.locale temporarily, but I couldn't get it working without error messages being translated too.