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

New cop that detects some logic after render/redirect_to #1276

Open
fatkodima opened this issue May 11, 2024 · 0 comments
Open

New cop that detects some logic after render/redirect_to #1276

fatkodima opened this issue May 11, 2024 · 0 comments

Comments

@fatkodima
Copy link
Contributor

fatkodima commented May 11, 2024

In rails controller, render/redirect_to are not halting the controller's action execution and any logic can be placed after it.
But this looks at least strange/confusing to do so. I recently discovered a case where people used this.

# bad
def action
  # ... logic
  render ...  # <--- not the last statement
  # ... other logic
end

# good
def action
  # ... logic
  # ... other logic
  render ...  # <-- the last statement
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