Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set flash for Ajax requests #9

Open
TylerRick opened this issue Sep 30, 2010 · 0 comments
Open

Don't set flash for Ajax requests #9

TylerRick opened this issue Sep 30, 2010 · 0 comments

Comments

@TylerRick
Copy link

I've noticed that after an Ajax request (create.wants.js / request.xhr?), when I refresh the page or go to another page, I see the flash message that was set by the action.

In my opinion, this is a bug. I don't think flash is ever used when responding to an Ajax request.

This fixes the problem for me:

--- a/vendor/plugins/resource_controller/lib/resource_controller/helpers/internal.rb
+++ b/vendor/plugins/resource_controller/lib/resource_controller/helpers/internal.rb
@@ -35,6 +35,7 @@ module ResourceController
     # Sets the flash and flash_now for the action, if it is present.
     #
     def set_flash(action)
+     return if request.xhr?
       set_normal_flash(action)
       set_flash_now(action)
     end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant