TIL, 2017-07-31
- Rails
where
–optimistically finds, if can’t, it will return an empty or will just return what it found, without an error. - You can do
reload
with a lock? - No implicit conversion of Symbol to Integer–just a missing hash key?
- No to polymorphic association–SQL Anti-pattern, since no freaking way to do the foreign key association.
- Creating a join table:
- Add foreign key
- Add index to both tables being joined
- Add unique index
shared_examples
Date.current.beginning_of_week
- Railties–used to hook onto Rails.
- You can fiddle around the
request.variant
(variant
is just a created attribute ofrequest
viaActionPack
–subclassApplicationController
and check therequest.user_agent
. Reference