<%= form_for(@post_form, format:'json', remote:true) do |f| %>
  <% if @post_form.new_topic? %>
    <%= f.hidden_field :board_id %>
  <% else %>
    <%= f.hidden_field :topic_id %>
  <% end %>

  <% if @post_form.new_topic? %>
    <div class="field">
      <%= f.label :title %>
      <%= f.text_field :title %>
    </div>
  <% end %>
  <div class="field">
    <%= f.label :author %>
    <%= f.text_field :author %>
  </div>
  <div class="field">
    <%= f.label :email %>
    <%= f.text_field :email %>
  </div>
  <%= render_cell :post, :image_upload_control, f %>
  <%= f.label :content %>
  <%= f.text_area :content %>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

<%= form_for(@post_form, format:'json', remote:true, data:{type: :json}) do |f| %>
  <% if @post_form.new_topic? %>
    <%= f.hidden_field :board_id %>
  <% else %>
    <%= f.hidden_field :topic_id %>
  <% end %>

  <% if @post_form.new_topic? %>
    <div class="field">
      <%= f.label :title %>
      <%= f.text_field :title %>
    </div>
  <% end %>
  <div class="field">
    <%= f.label :author %>
    <%= f.text_field :author %>
  </div>
  <div class="field">
    <%= f.label :email %>
    <%= f.text_field :email %>
  </div>
  <%= render_cell :post, :image_upload_control, f %>
  <%= f.label :content %>
  <%= f.text_area :content %>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

Fix Rails remote file upload not returning JSON bug.
Fix Rails remote file upload not returning JSON bug.

https://github.com/JangoSteve/remotipart/issues/85#issuecomment-58162242
