~/talk

Exploring Rails anti-patterns

Talkat RubyConf AU 2024 · 2024-04-11..04-12· [ruby-on-rails]
slides:none on file

A small Rails 7 app exists to prove each example actually works: controllers move business logic into a service object (placed order) and password resets live in a PasswordsResetController; long ActiveRecord queries become scopes or query objects and N+1s disappear by using includes and eager loading; performance finds come from the bullet gem and strict_loading or Rack Mini Profiler; null objects, presenters/decorators and delegate reduce view coupling; callbacks that hit external systems become background jobs or timed Faraday calls (timeout cut from 60s to 3s); tests cover refactors and delegation.

AI-written summary · about

  1. 0:00Introduction
  2. 1:49Anti-patterns and refactoring
  3. 2:52Fat controllers and logic
  4. 6:44Non-standard controller actions
  5. 8:30Separate controllers for actions
  6. 10:19Spaghetti SQL and Active Record
  7. 11:24N+1 queries and eager loading
  8. 14:32Law of Demeter and coupling
  9. 16:21Null object pattern for nil
  10. 19:11Overloaded views and presenters
  11. 22:43View helpers and view models
  12. 25:57Strict locals and magic comments
  13. 27:47Fat models and God objects
  14. 30:15Breaking down large models
  15. 31:44Rails callbacks pitfalls
  16. 33:30Service objects instead of callbacks
  17. 34:58Concerns vs pure Ruby objects
  18. 36:25Testing delegation
  19. 37:08Slow API calls and background jobs
  20. 38:18Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.