rails_best_practices

https://github.com/flyerhzm/rails_best_practices

Ruby

a code metric tool for rails projects

RailsBestPractices::Reviews::UseQueryAttributeReview#possible_query_attribute?

check if the node may use query attribute instead.

if the node contains two method calls, e.g. @user.login.nil?

for the first call, the receiver should be one of the class names and
the message should be one of the attribute name.

for the second call, the message should be one of nil?, blank? or present? or
it is compared with an empty string.

the node that may use query attribute.

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_query_attribute_review.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RailsBestPractices--Reviews--UseQueryAttributeReview-possible_query_attribute--for-pr


# Commit to git

git add lib/rails_best_practices/reviews/use_query_attribute_review.rbgit commit -m "better docs for RailsBestPractices::Reviews::UseQueryAttributeReview#possible_query_attribute?"


# 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--UseQueryAttributeReview-possible_query_attribute--for-pr

hub pull-request


# Celebrate!