Class: Saviour::LifeCycle::FileCreator
- Inherits:
-
Object
- Object
- Saviour::LifeCycle::FileCreator
- Defined in:
- lib/saviour/life_cycle.rb
Instance Method Summary collapse
-
#initialize(current_path, file, column, connection) ⇒ FileCreator
constructor
A new instance of FileCreator.
- #upload ⇒ Object
- #uploader ⇒ Object
Constructor Details
#initialize(current_path, file, column, connection) ⇒ FileCreator
4 5 6 7 8 9 |
# File 'lib/saviour/life_cycle.rb', line 4 def initialize(current_path, file, column, connection) @file = file @column = column @current_path = current_path @connection = connection end |
Instance Method Details
#upload ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/saviour/life_cycle.rb', line 11 def upload @new_path = @file.write return unless @new_path DbHelpers.run_after_rollback(@connection) do uploader.storage.delete(@new_path) end [@column, @new_path] end |
#uploader ⇒ Object
23 24 25 |
# File 'lib/saviour/life_cycle.rb', line 23 def uploader @file.uploader end |