Module: Adminpanel::Base

Extended by:
ActiveSupport::Concern
Included in:
Auth, Image, Permission, Role, Section, Sectionfile, User
Defined in:
app/models/concerns/adminpanel/base.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details



219
220
221
222
223
# File 'app/models/concerns/adminpanel/base.rb', line 219

def correlative_order_gallery
  self.class.galleries.each do |gallery|
    self.send(gallery.first.pluralize).ordered.each_with_index{ |image, index| image.update(position: index + 1) }
  end
end

#destroy_unattached_imagesObject



215
216
217
# File 'app/models/concerns/adminpanel/base.rb', line 215

def destroy_unattached_images
  self.class.galleries.each{|gallery| gallery.last.constantize.delete_all(model_id: nil) }
end