rails_best_practices

https://github.com/flyerhzm/rails_best_practices

Ruby

a code metric tool for rails projects

RailsBestPractices::Reviews::UseScopeAccessReview#current_user_redirect?

check a if node to see

if the conditional statement is compared with current_user or current_user.id,
and there is a redirect_to method call in the block body,
then it should be replaced by using scope access.

Source | Google | Stack overflow

Edit

git clone [email protected]:flyerhzm/rails_best_practices.git

cd rails_best_practices

open lib/rails_best_practices/reviews/use_scope_access_review.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RailsBestPractices--Reviews--UseScopeAccessReview-current_user_redirect--for-pr


# Commit to git

git add lib/rails_best_practices/reviews/use_scope_access_review.rbgit commit -m "better docs for RailsBestPractices::Reviews::UseScopeAccessReview#current_user_redirect?"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-RailsBestPractices--Reviews--UseScopeAccessReview-current_user_redirect--for-pr

hub pull-request


# Celebrate!