etabliocms_galleries 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@ module EtabliocmsGalleries
|
|
6
6
|
attr_accessor :attachable_temp
|
7
7
|
belongs_to :attachable, :polymorphic => true
|
8
8
|
before_save :set_attachable
|
9
|
+
before_save :set_pictures
|
10
|
+
attr_accesor :pictures_array
|
9
11
|
|
10
12
|
scope :visible, where(:visible => true)
|
11
13
|
|
@@ -17,8 +19,8 @@ module EtabliocmsGalleries
|
|
17
19
|
has_many :pictures, :order => 'position asc', :dependent => :destroy, :class_name => 'EtabliocmsGalleries::Picture'
|
18
20
|
accepts_nested_attributes_for :pictures, :allow_destroy => true
|
19
21
|
|
20
|
-
def
|
21
|
-
|
22
|
+
def set_pictures
|
23
|
+
pictures_array.each do |file|
|
22
24
|
pictures.build(:data => file)
|
23
25
|
end
|
24
26
|
end
|