# -*- encoding : utf-8 -*- class GalleryContent < ActiveRecord::Base has_many :gallery_images, :order => :position has_one :portlet, :as => :content, :dependent => :destroy STYLES = [["Petites miniatures",1], ["Diaporama",2], ["Petits carrés",3]] def dup @new = GalleryContent.new(self.attributes) @new.id = nil @new.save self.gallery_images.each do |gallery_image| new_g = gallery_image.dup new_g.gallery_content = @new new_g.save end @new end end