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

False positive on Rails/ActionControllerFlashBeforeRender #849

Closed
jcoyne opened this issue Oct 31, 2022 · 1 comment
Closed

False positive on Rails/ActionControllerFlashBeforeRender #849

jcoyne opened this issue Oct 31, 2022 · 1 comment

Comments

@jcoyne
Copy link
Contributor

jcoyne commented Oct 31, 2022

app/controllers/quick_reports_controller.rb:5:7: C: [Correctable] Rails/ActionControllerFlashBeforeRender: Use flash.now before render.
      flash[:success] = t("blacklight.feedback_form.success")
      ^^^^^

On this code:

      flash[:success] = t("blacklight.feedback_form.success")
      respond_to do |format|
        format.json do
          render json: flash
        end
        format.html do
          redirect_to params[:url]
        end
      end

If you do flash.now then the flash is lost on the redirect_to branch.

Using: rubocop-rails-2.17.2

@koic
Copy link
Member

koic commented Nov 2, 2022

This issue is similar to #843 and resolved by #844. False negatives may remain, but this unexpected new false positive is resolved. Please wait for the bug fix release.

@koic koic closed this as completed Nov 2, 2022
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