root/app/models/artwork_size.rb @ 3b6475bb
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
|
|||
4f40ad8a | Marc Dequènes (Duck) | "#{height} x #{width} mm"
|
|
b689e231 | Marc Dequènes (Duck) | end
|
|
end
|