Common Ruby mistakes in Rails





  1. Misuse predicates
  2. Forget to explicitly use “present?”, “blank?”, and “nil?”
  3. Don’t use memorization
  4. Forget that first come symbols, then single quotes, and then double quotes
  5. Use some random numbers and lines
  6. Often choose short or confusing words to name constants
  7. Excessively use postconditions
  8. Forget to remove unused parameters and variables, and other unused code
  9. Don’t use “public_send”
  10. Invokes the method identified by symbol, passing it any arguments specified. Unlike send, #public_send calls public methods only. When the method is identified by a string, the string is converted to a symbol.
  11. Write long and illegible conditions
  12. Think less code is always better
  13. Use obsolete syntax
  14. Excessively use “when” and “if”
  15. Don’t use rubocop and other tools for code analysis
  16. Rubocop notice almost all the errors described here
  17. Don’t fully understand the point about commenting
  18. Ruby is considered a very high-level language that doesn’t need commenting. Instead of writing another comment to your code, try making it more readable.

https://jetruby.com/

Comments