Project

General

Profile

Download (606 Bytes) Statistics
| Branch: | Tag: | Revision:
class ArtworkSize < ActiveRecord::Base
has_many :artworks, :order => "title ASC"

validates_presence_of :height, :width
validates_acceptance_of :height, :if => Proc.new {|artwork_size| artwork_size.height <= 0 }, :message => _("must be a positive non-zero number")
validates_acceptance_of :width, :if => Proc.new {|artwork_size| artwork_size.width <= 0 }, :message => _("must be a positive non-zero number")
validates_uniqueness_of :width, :scope => [:height], :message => _("is invalid, because this (height, width) couple already exist")

def human_size
"#{height} x #{width}"
end
end
(7-7/12)