lib/polygallery/has_polyphotos.rb in polygallery-0.3.1 vs lib/polygallery/has_polyphotos.rb in polygallery-0.3.2

- old
+ new

@@ -23,11 +23,10 @@ init_associations settings after_initialize do self.polygallery_options ||= self.polygallery_settings self.initialize_polygallery - # self.build_polygallery_photos # if new_record? && !polygallery_photos_attributes.is_a?(Hash) end after_initialize :build_polygallery_photos, :if => :new_record? before_validation :set_nested_attributes_to_correct_gallery before_validation :build_polygallery_photos, :unless => :photos_built? # , :on => :update before_validation :prune_empty_photos @@ -56,11 +55,11 @@ def set_nest(photo) photo.galleryable_id ||= galleryable_id photo.galleryable_type ||= galleryable_type photo.galleryable ||= galleryable photo.gallery_title ||= title - photo.polygallery_options = self.polygallery_settings + photo.polygallery_options ||= self.polygallery_settings photo.initialize_polyphoto photo.send(:"#{title}=", self) if photo.send(:"#{title}").nil? end def include_polygallery_settings(settings) @@ -142,12 +141,12 @@ # elsif attrs_for_photo.key? :built # puts 'Photo already built' else # puts 'Building a new photo' # puts attrs_for_photo.inspect - # raise 'WOO' if self.polygallery_photos - built_photo = self.polygallery_photos.build attrs_for_photo - set_nest built_photo + # built_photo = + self.polygallery_photos.build attrs_for_photo + # set_nest built_photo # self.polygallery_photos_attributes[index][:built] = true end end self.photos_built = true end