Skip to content

Latest commit

 

History

History
9 lines (8 loc) · 421 Bytes

File metadata and controls

9 lines (8 loc) · 421 Bytes

Database & Migrations

  • Always use the rails generate migration command to create migration files.
  • Use text over string if length varies significantly.
  • Wrap multi-record operations in transactions. Use save! (bang) inside transactions.
  • Keep scopes as one-liners. Complex queries belong in search/query objects.
  • Never use Post.all without pagination.
  • Avoid .count in loops.
  • Use counter_cache.