Validate both the model and its translations
This way we guarantee there will be at least one translation for a model and we keep compatibility with the rest of the application, which ideally isn't aware of globalize.
This commit is contained in:
@@ -17,10 +17,7 @@ class Poll::Question < ActiveRecord::Base
|
||||
has_many :partial_results
|
||||
belongs_to :proposal
|
||||
|
||||
translation_class.instance_eval do
|
||||
validates :title, presence: true, length: { minimum: 4 }
|
||||
end
|
||||
|
||||
validates_translation :title, presence: true, length: { minimum: 4 }
|
||||
validates :author, presence: true
|
||||
validates :poll_id, presence: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user