Module: Gluttonberg::Library::AttachmentMixin::ClassMethods
- Defined in:
- lib/gluttonberg/library/attachment_mixin.rb
Instance Method Summary collapse
-
#generate_name ⇒ Object
Generate auto titles for those assets without name.
- #initialize_storage ⇒ Object
Instance Method Details
#generate_name ⇒ Object
Generate auto titles for those assets without name
36 37 38 39 40 41 42 43 44 |
# File 'lib/gluttonberg/library/attachment_mixin.rb', line 36 def generate_name assets = Asset.find(:all , :conditions => { :name => "" } ) assets.each do |asset| p asset.file_name asset.name = asset.file_name.split(".")[0] asset.save end 'done' # this just makes the output nicer when running from slice -i end |
#initialize_storage ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/gluttonberg/library/attachment_mixin.rb', line 24 def initialize_storage storage_class_name = Rails.configuration.asset_storage.to_s.downcase.camelize begin storage_module = Gluttonberg::Library::Storage.const_get(storage_class_name) rescue NameError raise Exception, "Cannot load storage module '#{storage_class_name}'" end include storage_module end |