Saturday 7 September 2013

Rails respond_to format.js results in ActionController::UnknownFormat

Rails respond_to format.js results in ActionController::UnknownFormat

I have a button:
<%= button_to "Delete", @test, method: :delete, :remote => true %>
and in the tests_controller, here's my destroy method:
def destroy
@project = Project.find(params[:project_id])
@test = Test.find(params[:id])
@test.destroy
respond_to do |format|
format.js
end
end
However, upon click I get a run time error:
ActionController::UnknownFormat
Commenting out the respond_to block makes the error go away. What could
the issue be?

No comments:

Post a Comment