validates :title, :presence => true, :length => {:maximum => 100}
validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
+ before_validation :valid_encode
+
+ def valid_encode
+ ['title'].each do |a|
+ next if attributes[a] == nil
+ raise Pettanr::BadRequest unless attributes[a].valid_encoding?
+ end
+ end
def supply_default
self.visible = 0 if self.visible.blank?