Class: Workarea::AssetsSeeds
- Inherits:
-
Object
- Object
- Workarea::AssetsSeeds
- Defined in:
- app/seeds/workarea/assets_seeds.rb
Instance Method Summary collapse
Instance Method Details
#load_assets(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/seeds/workarea/assets_seeds.rb', line 10 def load_assets(path) if File.directory?(path) Dir.glob("#{path}/*.{jpeg,jpg,png,gif}").each do |path| filename = path.split('/').last.split('.').first Content::Asset.create!( name: filename.titleize, file: File.new(path), alt_text: filename.titleize ) end end end |