Module: Card::Set::Abstract::Attachment::UploadCache

Extended by:
Card::Set
Defined in:
tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset_modules

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Instance Attribute Details

#action_id_of_cached_uploadObject

action id of the cached upload



5
6
7
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 5

def action_id_of_cached_upload
  @action_id_of_cached_upload
end

Instance Method Details

#assign_attachment(file, original_filename) ⇒ Object



43
44
45
46
47
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 43

def assign_attachment file, original_filename
  send "#{attachment_name}=", file
  write_identifier
  @current_action.update_attributes! comment: original_filename
end

#preliminary_upload?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 69

def preliminary_upload?
  Card::Env && Card::Env.params[:attachment_upload]
end

#save_preliminary_upload?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 73

def save_preliminary_upload?
  @action_id_of_cached_upload.present?
end

#tmp_upload_dir(_action_id = nil) ⇒ Object

place for files if card doesn't have an id yet



78
79
80
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 78

def tmp_upload_dir _action_id=nil
  "#{files_base_dir}/#{upload_cache_card.id}"
end

#upload_cache_cardObject

used for uploads for new cards until the new card is created



65
66
67
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 65

def upload_cache_card
  @upload_cache_card ||= Card["new_#{attachment_name}".to_sym]
end