Sha256: 58a4cc1d44a8b090cefb0a7b7a7b4db58f2b30f42996cb8645c3380ff9ed8110
Contents?: true
Size: 546 Bytes
Versions: 34
Compression:
Stored size: 546 Bytes
Contents
module Workarea class AssetsSeeds def perform puts 'Adding assets...' load_assets("#{Core::Engine.root}/data/content_assets") load_assets("#{Rails.root}/data/content_assets") end 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) ) end end end end end
Version data entries
34 entries across 34 versions & 1 rubygems