This error popped when testing with the Megilla project using version 0.1.1 of the gem
Tasks:
Increased version to 0.1.2
Modified readme since it contained a few errors
Added hash.symbolize_keys! since when using a hash with string keys keys the method attachment.delete(:data) does not work, check the following example:
Also, even if using the delete method on a hash with string keys worked, when the attachment with string keys instead of symbols arrives to activestorage we receive the following error message:
ArgumentError:
wrong number of arguments (given 1, expected 0)
# /Users/ricardocortio/.rvm/gems/ruby-2.4.1/gems/activestorage-5.2.2/app/models/active_storage/blob.rb:64:in `create_after_upload!'
so I checked how this was working on rails. It seems the method create_blob_from has the following lines:
when Hash
ActiveStorage::Blob.create_after_upload!(attachable)
and the method create_after_upload! receives keyword arguments, not positional arguments
Notes:
0.1.1
of the gemTasks:
0.1.2
hash.symbolize_keys!
since when using a hash with string keys keys the methodattachment.delete(:data)
does not work, check the following example: Also, even if using thedelete
method on a hash with string keys worked, when the attachment with string keys instead of symbols arrives to activestorage we receive the following error message:so I checked how this was working on rails. It seems the method
create_blob_from
has the following lines:and the method
create_after_upload!
receives keyword arguments, not positional argumentstherefore when this hash was sent to this method we would get the previously mentioned argument error.
attachment_from_data
got to 15.39/15, so I had to do some refactoring