My problem is the next:
I h开发者_StackOverflow社区ave a method which validate the image dimension
def validates_attachment_dimension
aspect = self.width / self.height
if aspect < 0.95 || aspect > 1.05
errors.add_to_base("La imagen '#{self.photo_file_name}' debe tener un aspecto cuadrado")
end
end
I have a parent model which have a relation with other model for images (child).
So when i inspect the @parent_model the render view (I inspect in @parent_model.errors...errors.child_model.base) The @parent_model.errors don´t have the errors (only save the first error of child_model)
However when i read the errors attribute in child_model are fine (@parent_model.child_model.errors...).
Why have I got this problem? How can i show the errors for various models simultaneously?
I replace 'add_to_base' method by 'add' method. Then SO I can display a custom message.
Thanks Zabba
精彩评论