config/initializers/fix.rb
def normalize_parameters(value)
        case value
        when Hash
          if value.has_key?(:tempfile)
            upload = value[:tempfile]
            upload.extend(UploadedFile)
            upload.original_path = value[:filename]
            upload.content_type = value[:type]
            upload
          else
            h = {}
            value.each { |k, v| h[k] = normalize_parameters(v) }
            h.with_indifferent_access
          end
        when Array
          value.map { |e| normalize_parameters(e) }
        else
          value.force_encoding(Encoding::UTF_8) if value.respond_to?(:force_encoding)
          value
        end
      end
# Convert nested Hashs to HashWithIndifferentAccess and replace
# file upload hashs with UploadedFile objects
Convert nested Hashs to HashWithIndifferentAccess and replace
file upload hashs with UploadedFile objects
Convert nested Hashs to HashWithIndifferentAccess and replace file upload hashs with UploadedFile objects
def normalize_parameters(value)
        case value
        when Hash
          if value.has_key?(:tempfile)
            upload = value[:tempfile]
            upload.extend(UploadedFile)
            upload.original_path = value[:filename]
            upload.content_type = value[:type]
            upload
          else
            h = {}
            value.each { |k, v| h[k] = normalize_parameters(v) }
            h.with_indifferent_access
          end
        when Array
          value.map { |e| normalize_parameters(e) }
        else
          value.force_encoding(Encoding::UTF_8) if value.respond_to?(:force_encoding)
          value
        end
      end
def normalize_parameters ( value ) case value when Hash if value . has_key? ( :tempfile ) upload = value [ :tempfile ] upload . extend ( UploadedFile ) upload . original_path = value [ :filename ] upload . content_type = value [ :type ] upload else h = { } value . each { | k , v | h [ k ] = normalize_parameters ( v ) } h . with_indifferent_access end when Array value . map { | e | normalize_parameters ( e ) } else value . force_encoding ( Encoding :: UTF_8 ) if value . respond_to? ( :force_encoding ) value end end
Convert nested Hashs to HashWithIndifferentAccess and replace
file upload hashs with UploadedFile objects
Convert nested Hashs to HashWithIndifferentAccess and replace file upload hashs with UploadedFile objects
value