Ruby and Rails (and stuff)

<3

  • About/WTF?

Categories

  • Database
  • Docker
  • Education
  • Exploring
  • File Storage
  • Flow Control
  • Gem
  • Git
  • Haml
  • Humor
  • Linux
  • Quick Tip
  • Radiant CMS
  • Rails
  • Rake
  • Search
  • Site
  • Testing

Recent Posts

  • Watermarking Images with Active Storage
  • Your App’s Helpers in Administrate
  • Foreign Key Column Types
  • A Convention for Active Storage Attachment Management
  • Refinements: Fancy Monkey-patching

Archives

  • September 2018
  • August 2018
  • October 2017
  • October 2015
  • April 2015
  • March 2015
  • December 2014
  • November 2014
  • August 2014
  • May 2013
  • February 2013
  • January 2013
  • July 2012
  • June 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • October 2010
  • April 2010
  • July 2009
  • April 2009
  • February 2009
  • January 2009
  • December 2008
  • October 2008
  • September 2008

Recent Comments

  • codesnik on Quick and Dirty: Public vs Private vs Protected
  • Mario Zigliotto on Ruby’s % Notation
  • Mario Zigliotto on Moving from GitLab to GitHub
  • Mario Zigliotto on Moving from GitLab to GitHub
  • me on Playing with Crystal Lang

Month: December 2014

A Toy Story Based Mnemonic Device for has_one

December 21, 2014 by me·0 Comments

Use Woody for Has_one

Here’s an awesome Toy Story inspired mnemonic device for remembering the proper use of Rails’ `has_one` associations.

Andy “has_one” Woody.

Woody “belongs_to” Andy.

Where is the foreign key? On Woody’s sole!

Credit goes to Stack Overflow user “mike” from a comment on a related topic.

Proudly powered by WordPress. Theme: Flat 1.7.11 by Themeisle.