ruby on rails - Uploading files using remote:true and remotipart + carrierwave gems -
i want make remote file upload via remotipart + carrierwave. problem upload works, seems uploaded usual html. or uploaded via ajax, appropriate js file not called. have form_for remote:true, , corrseponding controller method create. since form submitted js, create.js.erb used.
<% if @syllabus.errors.present? %> $('#syllabus-errors').html('<%= escape_javascript(render 'layouts/error_messages', object: @syllabus) %>'); <% else %> alert("ds"); $('#modal-body').html(<%= escape_javascript(render 'layouts/thanks') %>); $('#syllabus-errors').html(""); <% end %>
logs show this:
(0.1ms) begin transaction (0.1ms) rollback transaction rendered layouts/_error_messages.html.erb (1.0ms) rendered syllabuses/create.js.erb (12.0ms)
it kinda strange error_messages rendered earlier create.js.erb, error_messages being rendered inside create.js.erb.
i resolved problem adding if:
<% if remotipart_submitted? %> <% else %> <% end %>
Comments
Post a Comment