Class: AsyncPaperclipUploader::Permanent
- Inherits:
-
Object
- Object
- AsyncPaperclipUploader::Permanent
- Defined in:
- lib/async_paperclip_uploader/permanent.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(class_name, object_id, attribute, filepath) ⇒ Permanent
constructor
A new instance of Permanent.
Constructor Details
#initialize(class_name, object_id, attribute, filepath) ⇒ Permanent
Returns a new instance of Permanent.
4 5 6 7 8 |
# File 'lib/async_paperclip_uploader/permanent.rb', line 4 def initialize(class_name, object_id, attribute, filepath) @object = Object::const_get(class_name).find_by_id(object_id) @attribute = attribute @filepath = filepath end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/async_paperclip_uploader/permanent.rb', line 10 def call @object.send("#{@attribute}=", file) if @object.save if block_given? yield end clean end end |