Reputation: 3317
I'm having an issue where I submit a form successfully. It redirects to the show action. If I refresh the page (ctrl+r) it opens a prompt asking if I want to 'Confirm Form Resubmit', which I don't want to do.
Has anyone seen this problem before and know how to fix it?
Here's some code:
The form view:
= simple_form_for @book_request do |f|
= f.input :title
.actions= f.submit
The show view
%dl
%dt Title
%dd= @book_request.title
My controller:
...
respond_to :html
def show
respond_with(@book_request = BookRequest.find(params[:id]))
end
def new
respond_with(@book_request = BookRequest.new)
end
def create
@book_request = BookRequest.new(params[:book_request])
@book_request.save
respond_with(@book_request)
end
def edit
respond_with(@book_request = BookRequest.find(params[:id]))
end
def update
@book_request = BookRequest.find(params[:id])
@book_request.update_attributes(params[:book_request])
respond_with(@book_request)
end
...
Update:
This issue looks like it has been resolved. I just updated to chrome Version 26.0.1410.43 and it works as expected.
Upvotes: 1
Views: 2021
Reputation: 694
This is bug in chrome. Should be fixed soon. For more info see https://code.google.com/p/chromium/issues/detail?id=177855
Edit: If you want temporary fix (for development purposes) you can just add any get parameter to the for submission url. After handling POST, redirect as usual.
= simple_form_for @book_request, url: books_url(time: DateTime.now) do |f|
= f.input :title
.actions= f.submit
Upvotes: 1