I have a form_with
that submits remotely and works perfectly for almost everyone. However, every once in a while, a user gets this error:
ActionController::UnknownFormat: TestimonialsController#create is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
View:
<%= form_with(model: [@event, @testimonial]) do |form| %>
...
<% end %>
Action:
def create
@testimonial = @event.testimonials.find_or_initialize_by(user: Current.user)
@testimonial.assign_attributes testimonial_params.merge({status: :pending})
@testimonial.save
end
Response:
It's in a file called create.js.erb
Question: I have looked everywhere but I have not idea why certain users request HTML instead of JS, which is what every other user gets. What am I missing? I really don't want to support HTML responses.