Mandatory Readings for Ruby and Rails Engineers
It’s About Time (Zones) by Elle Meredith
Don’t Use
Time.now
Date.today
Date.today.to_time
Time.parse("2015-07-04 17:05:37")
Time.strptime(string, "%Y-%m-%dT%H:%M:%S%z")
Do Use
Time.current
2.hours.ago
Time.zone.today
Date.current
1.day.from_now
Time.zone.parse("2015-07-04 17:05:37")
Time.strptime(string, "%Y-%m-%dT%H:%M:%S%z").in_time_zone
Falsehoods programmers believe about time
7 Patterns to Refactor Fat ActiveRecord Models by Sasha Razvina
Refactoring Fat Models with Patterns by Bryan Helmkamp
- Extract Value Objects
- Extract Service Objects
- Extract Form Objects
- Extract Query Objects
- Introduce View Objects
- Extract Policy Objects
- Extract Decorators