Module: Sunrise::Utils

Defined in:
lib/sunrise/utils.rb,
lib/sunrise/utils/mysql.rb,
lib/sunrise/utils/header.rb,
lib/sunrise/utils/i18n_backend.rb,
lib/sunrise/utils/settingslogic.rb,
lib/sunrise/utils/transliteration.rb,
lib/sunrise/utils/accessible_attributes.rb

Defined Under Namespace

Modules: AccessibleAttributes, Header, Mysql, Transliteration Classes: I18nBackend, Settingslogic

Constant Summary collapse

IMAGE_TYPES =
['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']

Class Method Summary collapse

Class Method Details

.clear_cacheObject



22
23
24
25
26
27
# File 'lib/sunrise/utils.rb', line 22

def self.clear_cache
  cache_store = Rails.application.config.action_controller.cache_store
 cache_store.clear if cache_store
	  
 FileUtils.rm_r(Dir.glob(Rails.root.join('public', 'cache', '*').to_s), :force => true)
end

.parameterize_filename(filename) ⇒ Object



15
16
17
18
19
20
# File 'lib/sunrise/utils.rb', line 15

def self.parameterize_filename(filename)
  extension = File.extname(filename)
  basename = filename.gsub(/#{extension}$/, "")
    
  [basename.parameterize('_'), extension].join.downcase
end