root/app/models/artwork_size.rb @ 1ed9be73
b689e231 | Marc Dequènes (Duck) | 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
|