Skip to content

Instantly share code, notes, and snippets.

@awesome
Created February 22, 2018 02:00
Show Gist options
  • Save awesome/f1e7d2d3dfb01759b90dab4656e89579 to your computer and use it in GitHub Desktop.
Save awesome/f1e7d2d3dfb01759b90dab4656e89579 to your computer and use it in GitHub Desktop.
holy shit! the capitalized underscore _ID is a column name! gonna use: `.underscore.camelcase` for an easy win; see: http://api.rubyonrails.org/classes/String.html#method-i-camelize
irb(main):016:0> "cool_id".camelcase
=> "CoolId"
irb(main):017:0> "cool_id".camelcase(:lower)
=> "coolId"
irb(main):018:0> "ServerID".underscore
=> "server_id"
irb(main):019:0> "ServerID".underscore.camelcase(:lower)
=> "serverId"
irb(main):020:0> "ServerID".camelcase(:lower)
=> "serverID"
irb(main):021:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment