jfn_app/app/models/gallery_content.rb
Nicolas Bally 0d62fbe429 initial
2011-12-29 11:06:37 +01:00

28 lines
475 B
Ruby

# -*- encoding : utf-8 -*-
class GalleryContent < ActiveRecord::Base
has_many :gallery_images, :order => :position
has_one :portlet, :as => :content, :dependent => :destroy
STYLES = []#[["Style 1",1], ["Style 2",2]]
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