Class: Hyrax::Actors::CreateWithRemoteFilesActor
- Inherits:
-
AbstractActor
- Object
- AbstractActor
- Hyrax::Actors::CreateWithRemoteFilesActor
- Defined in:
- app/actors/hyrax/actors/create_with_remote_files_actor.rb
Overview
If there is a key ‘:remote_files’ in the attributes, it attaches the files at the specified URIs to the work. e.g.:
attributes[:remote_files] = filenames.map do |name|
{ url: "https://example.com/file/#{name}", file_name: name }
end
Instance Attribute Summary
Attributes inherited from AbstractActor
Instance Method Summary collapse
-
#create(env) ⇒ Boolean
True if create was successful.
-
#update(env) ⇒ Boolean
True if update was successful.
Methods inherited from AbstractActor
Constructor Details
This class inherits a constructor from Hyrax::Actors::AbstractActor
Instance Method Details
#create(env) ⇒ Boolean
Returns true if create was successful.
11 12 13 14 |
# File 'app/actors/hyrax/actors/create_with_remote_files_actor.rb', line 11 def create(env) remote_files = env.attributes.delete(:remote_files) next_actor.create(env) && attach_files(env, remote_files) end |
#update(env) ⇒ Boolean
Returns true if update was successful.
18 19 20 21 |
# File 'app/actors/hyrax/actors/create_with_remote_files_actor.rb', line 18 def update(env) remote_files = env.attributes.delete(:remote_files) next_actor.update(env) && attach_files(env, remote_files) end |