jnunemaker/joint

Rails 3.0.2 or greater

pollingj opened this issue · 1 comments

I've recently upgraded to Rails 3.0.3 from Rails 3.0.1 and Joint no longer works in production mode. This is because the UploadedFile class has been changed in ActionDispatch. A good explanation can be found here - http://marklunds.com/articles/one/433

The actual error I get in production mode when doing a file upload is

TypeError (can't convert ActionDispatch::Http::UploadedFile into String):

For the moment I've rolled back to Rails 3.0.1. Have you got any pointers for making Joint work with the recent ActionDispatch updates?

It appears fixed in master.
rails/rails@c52e2cf

For now you could certainly just patch the UploadedFile class until the next release.

module ActionDispatch
  module Http
    class UploadedFile
      def open
        @tempfile.open
      end

      def path
        @tempfile.path
      end

      def read(*args)
        @tempfile.read(*args)
      end

      def rewind
        @tempfile.rewind
      end

      def size
        @tempfile.size
      end
    end
  end
end