Code, Strings, and Keys

    • About Thomas Powell
    • Account
    • It’s been [0] days since [program] last updated
    • Login
    • Password Reset
    • Pianist / Accompanist / Music Director Resume
    • Reading List 2025
    • Register
    • Running Gear – Shoes, Treadmill, and Bandages
    • Site Map
Illustration of a bird flying.
  • Enums in ActiveRecord 4.1 and options_for_select

    Update: This StackOverflow answer provides a better way to use a drop-down with enums. I could’ve sworn I tried that, but maybe not. I discovered something interesting about the way ActiveRecord 4.1 enums work. If you’re trying to use them with options_for_select, you may need to do some little acrobatics with your enums. Assume your…

    May 16, 2014
  • Nesting resource routes with alternate scopes and keys + strong parameters.

    DISCLAIMER: This is a contrived example translated from a case where it actually made way more sense to break the familiar nested resource pattern. Also, I haven’t double-checked how Rails’ pluralization rules would affect the naming of any given Species. Say you have a pair of models: class Species # id # latin_name_with_underscores end class…

    May 15, 2014
  • Git wrapper for vim: fugitive.vim

    Today’s browsing through “plugins that I haven’t made good enough use of” brings me to vim-fugitive: :Gstatus pulls git status output into a vim split window. Pressing – on the line that a file is listed on either adds or removes a file from staging, and :Gcommit commits it. :Gdiff opens a vertical split next…

    May 14, 2014
←Previous Page
1 … 71 72 73 74 75 … 312
Next Page→

Code, Strings, and Keys

Proudly powered by WordPress