add to the gallery modell on has_many paintings :dependent => :destroy