TIL, 2017-03-08
- Designing API endpoints: Try to provide as much to the client as possible.
- To organize/group selected models, get all first, then do the
group_by
, becausegroup_by
removes their AR parts and turns them into arrays. - The back-end will adjust to the front-end if possible. When thinking of how APIs are supposed to be structured, look at the solid APIs (Stripe, Github, etc.)
- Do not be a condescending fuck.
- Major major thinking point/important thing when reasoning about code is that if it is something that is expected to change at some point. Think of what will break if things change.
- Joining using ActiveRecord is not as hard as you think, just practice it and check the generated SQL by
to_sql
.