Today I Learned

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 of request via ActionPack–subclass ApplicationController and check the request.user_agent. Reference

This project is maintained by daryllxd