You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Rails 4, ActionController::Parameters subclassed HashWithIndifferentAccess so lib/attachinary/utils.rb process_input called the process_hash function successfully by first hitting the Array case which then would hit the Hash case to call process_hash.
In Rails 5, ActionController::Parameters no longer subclasses HashWithIndifferentAccess so the switch statement in lib/attachinary/utils.rb process_input hits the else case and returns the same input data.
This is not the expected behavior as it should call to_h on the input in that scenario and re-call process_input.
Before process_input run:
def self.process_input(input, upload_options, scope=nil)
case input
when :blank?.to_proc
nil
when lambda { |e| e.respond_to?(:read) }
upload_options.merge! resource_type: 'auto'
upload_info = Cloudinary::Uploader.upload(input, upload_options)
process_hash upload_info, scope
when String
process_json(input, scope)
when Hash
process_hash(input, scope) # hits here in Rails 4 after hitting Array
when Array
input = input.map{ |el| process_input(el, upload_options, scope) }.flatten.compact
input = nil if input.empty?
input
else
input # hits here in Rails 5 because ActionController::Parameters is not a Hash
end
end
The text was updated successfully, but these errors were encountered:
In Rails 4, ActionController::Parameters subclassed HashWithIndifferentAccess so lib/attachinary/utils.rb
process_input
called theprocess_hash
function successfully by first hitting theArray
case which then would hit theHash
case to callprocess_hash
.Before
process_input
run:After:
In Rails 5, ActionController::Parameters no longer subclasses HashWithIndifferentAccess so the switch statement in lib/attachinary/utils.rb
process_input
hits theelse
case and returns the same input data.This is not the expected behavior as it should call
to_h
on the input in that scenario and re-callprocess_input
.Before
process_input
run:After:
self.process_input
:The text was updated successfully, but these errors were encountered: