- Fat Model, Skinny Controller
- Object-Oriented Design Patterns
- Single Responsibility Principle
http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/
Purpose: encapsulate complex queries
Benefits:
- no unwieldy SQL in model
- keeps benefits of AR scopes
DeliveryOption.current
Purpose: encapsulate complex actions, concerns, or responsibilities that reach across multiple models
Benefits:
- SRP makes maintenance easier
- developers know where to go to tweak behavior
- easier to test
- tends to make codebase DRYer
active_discount
- Practical Object-Oriented Design in Ruby, by Sandi Metz
- Objects on Rails, by Avdi Grim
- Refactoring: Ruby Edition, by Jay Fields, Shane Harvie, Martin Fowler, Kent Beck
https://www.youtube.com/watch?v=WpkDN78P884 (mentioned in the discussion)
- László Bácsi
- @icanscale
- github.com/lackac