+ validates :title, :presence => true, :length => {:maximum => 100}\r
+ validates :width, :presence => true, :numericality => true, :not_zero => true
+ validates :height, :presence => true, :numericality => true, :not_zero => true
+ validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0...4}
+ validates :editable, :presence => true, :numericality => true, :inclusion => {:in => 0...4}
+
+ before_save do |r|
+ r.supply_default
+ end
+
+ def supply_default
+ self.visible = 0 if self.visible.blank?
+ self.editable= 0 if self.editable.blank?
+ end
+