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

Setting flash within success/failure block doesn't overwrite automatically set flash #36

Closed
allangrant opened this issue Jan 21, 2010 · 4 comments

Comments

@allangrant
Copy link

This is probably the expected behavior, but it's less than ideal. When setting a flash within success/failure blocks, the flash is added to the flash that's automatically set by inherited_resources. I think a better behavior would be to only automatically add a flash if one was not explicitly set in the success/failure block. For example, in the following code I would expect one flash, but end up with two:

def update
update! do |success, failure|
success.html do
flash[:success] = 'Your account has been updated.'
redirect_to account_path
end
end
end

@josevalim
Copy link
Contributor

Please, which IR version are you using? This should be solved if you are using latest responders version with IR.

@allangrant
Copy link
Author

I'm using inherited_resources-1.0.2 without responders. Tried with responders-0.4.2 and the behavior is the same.

@josevalim
Copy link
Contributor

:( Could you please try adding a failing case to the suite?

@allangrant
Copy link
Author

Although I know it's lame on my part, I'm afraid I don't know how to. :( I need to get up to speed on Rails TDD/rspec/etc, but won't get to that within any reasonable time.

This issue was closed.
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

2 participants