Project

General

Profile

« Previous | Next » 

Revision 3807b362

Added by Marc Dequènes over 12 years ago

  • ID 3807b362f44c00b771ed8ed5b4da60799752825b

[evol] an artwork can have multiple materials

View differences:

app/models/artwork.rb
1 1
class Artwork < ActiveRecord::Base
2 2
  belongs_to :artwork_set
3 3
  belongs_to :artwork_group
4
  belongs_to :artwork_material
5 4
  belongs_to :artwork_size
6 5
  belongs_to :artwork_condition
7 6
  belongs_to :artwork_placement_reason
8 7
  has_many :artwork_step_images, :order => "date ASC"
9 8
  has_and_belongs_to_many :artwork_supports, :order => "name ASC"
9
  has_and_belongs_to_many :artwork_materials, :order => "name ASC"
10 10

  
11
  validates_presence_of :title, :artwork_material_id, :artwork_size_id, :artwork_condition_id
11
  validates_presence_of :title, :artwork_size_id, :artwork_condition_id
12 12
  validates_uniqueness_of :title
13 13
  validates_length_of :title, :within => 1..256, :allow_blank => true
14 14
  validates_length_of :placement_location, :within => 1..256, :allow_blank => true
15
  validates_associated :artwork_set, :artwork_group, :artwork_material, :artwork_size, :artwork_condition
15
  validates_associated :artwork_set, :artwork_group, :artwork_size, :artwork_condition
16 16

  
17 17
  before_save {|model| model.artwork_group = nil if model.artwork_set.nil? }
18 18

  

Also available in: Unified diff