jordifierro/rails-api-base

View on GitHub
app/controllers/users_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use find_by instead of dynamic find_by_confirmation_token.
Open

    user = User.find_by_confirmation_token(params[:token])
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks dynamic find_by_* methods. Use find_by instead of dynamic method. See. https://github.com/bbatsov/rails-style-guide#find_by

Example:

# bad
User.find_by_name(name)

# bad
User.find_by_name_and_email(name)

# bad
User.find_by_email!(name)

# good
User.find_by(name: name)

# good
User.find_by(name: name, email: email)

# good
User.find_by!(email: email)

Use find_by instead of dynamic find_by_reset_password_token.
Open

    user = User.find_by_reset_password_token(params[:token])
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks dynamic find_by_* methods. Use find_by instead of dynamic method. See. https://github.com/bbatsov/rails-style-guide#find_by

Example:

# bad
User.find_by_name(name)

# bad
User.find_by_name_and_email(name)

# bad
User.find_by_email!(name)

# good
User.find_by(name: name)

# good
User.find_by(name: name, email: email)

# good
User.find_by!(email: email)

Prefer Date or Time over DateTime.
Open

      user.confirmed_at = DateTime.current
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks for uses of DateTime that should be replaced by Date or Time.

Example:

# bad - uses `DateTime` for current time
DateTime.now

# good - uses `Time` for current time
Time.now

# bad - uses `DateTime` for modern date
DateTime.iso8601('2016-06-29')

# good - uses `Date` for modern date
Date.iso8601('2016-06-29')

# good - uses `DateTime` with start argument for historical date
DateTime.iso8601('1751-04-23', Date::ENGLAND)

There are no issues that match your filters.

Category
Status