Module: FilenameToSlug
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/filename_to_slug.rb
Instance Method Summary collapse
Instance Method Details
#filename_to_slug ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/filename_to_slug.rb', line 20 def filename_to_slug if self.class. self.class..each do |k,v| if self.send(k).file? full_file_name = self.send("#{k}_file_name") extension = File.extname(full_file_name)[1..-1] file_name = full_file_name[0..full_file_name.size-extension.size-1] self.send("#{k}").instance_write(:file_name, "#{file_name.filename_to_slug}.#{extension.filename_to_slug}") end end end end |