I work with AngularJS and the jQuery-file-uploader plugin. I configured rails to transfer my parameters with
ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end
This works great for everyone except when I try to upload my files. I use the uploader plugin a little differently than usual, but it should work anyway. Rather, letting the plugin upload files when they are added, I create a new entry and THEN upload the files. The request starts correctly, but the parameter for the file (s) / is not wrapped with rails. In my magazines I get
Processing by MeetingsController#update as JSON Parameters: {"icon"=>#<ActionDispatch::Http::UploadedFile:0x007fde79178b58 @original_filename="006.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"icon\"; filename=\"006.png\"\r\nContent-Type: image/png\r\n", @tempfile=#<File:/var/folders/_v/qsm9g7nn00s0jmfkynmvwp140000gn/T/RackMultipart20130505-15753-17ig2it>>, "id"=>"35"}
I expect to see the parameter
{ :meeting => { :icon => ... }}
In my MeetingsController I have
wrap_parameters :meeting, include: [..., :icon, ...]
Creating a record that also passes through this controller works fine, and the parameters are wrapped as expected, however this will not work. Am I doing something wrong?
ruby-on-rails jquery-file-upload
PaReeOhNos May 05 '13 at 2:44 am 2013-05-05 02:44
source share