Module: AbAdmin::Models::Asset::ClassMethods

Defined in:
lib/ab_admin/models/asset.rb

Instance Method Summary collapse

Instance Method Details

#clean!Object


36
37
38
# File 'lib/ab_admin/models/asset.rb', line 36

def clean!
  where('assetable_id IS NULL OR assetable_id = 0 AND created_at < ?', 1.week.ago).destroy_all
end

#ext_listObject


31
32
33
34
# File 'lib/ab_admin/models/asset.rb', line 31

def ext_list
  return unless uploaders[:data]
  uploaders[:data].new.extension_whitelist
end

#move_to(index, id) ⇒ Object


27
28
29
# File 'lib/ab_admin/models/asset.rb', line 27

def move_to(index, id)
  where(id: id.to_i).update_all(sort_order: index)
end