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
Returns a new instance of FileCreator.
6 7 8 9 10 11 |
# File 'lib/saviour/life_cycle.rb', line 6 def initialize(current_path, file, column, connection) @file = file @column = column @current_path = current_path @connection = connection end |
Instance Method Details
#upload ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/saviour/life_cycle.rb', line 13 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
25 26 27 |
# File 'lib/saviour/life_cycle.rb', line 25 def uploader @file.uploader end |