Module: Adminpanel::Base
- Extended by:
- ActiveSupport::Concern
- Included in:
- Auth, Image, Page, 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
#correlative_order_gallery ⇒ Object
245 246 247 248 249 |
# File 'app/models/concerns/adminpanel/base.rb', line 245 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_images ⇒ Object
241 242 243 |
# File 'app/models/concerns/adminpanel/base.rb', line 241 def destroy_unattached_images self.class.galleries.each{|gallery| gallery.last.constantize.where(model_id: nil).delete_all } end |