Skip to content

Instantly share code, notes, and snippets.

# Shoulda activemodel cheatsheet
# DB
should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false)
should have_db_index(:email).unique(:true)
# Associations
should belong_to :company
should have_one(:profile).dependent(:destroy)
should have_many(:posts).dependent(:nullify)
@maker-leo
maker-leo / Sublime-Text.markdown
Last active December 14, 2015 19:19 — forked from leoallen85/Sublime-Text.markdown
A guide to getting the most out of your new favourite editor Sublime Text

Sublime Text 2

Although you're free to use any editor we recommend Sublime. Here's how to get the most out of it

Setting up

Once you've installed Sublime there's a few things you should do to get things set up properly:

Package Control

@maker-leo
maker-leo / Preferences.sublime-settings
Last active December 14, 2015 19:19 — forked from leoallen85/Preferences.sublime-settings
Suggested settings for your Preferences.sublime-settings.
{
// This is the ruby default
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
// This shows all your whitespace, including spaces and tabs
// helps keep code clean and properly indented!
"draw_white_space": "all",
@maker-leo
maker-leo / Ruby.sublime-build
Created March 11, 2013 16:53 — forked from leoallen85/Ruby.sublime-build
Go to Sublime Text 2 > Preferences > Browse Packages... to open finder, then open the Ruby.sublime-build file in the Ruby folder and replace the contents with this to get the Build command (cmd + B) working with RVM
{
"env":{
"PATH":"${HOME}/.rvm/bin:${PATH}"
},
"cmd": ["rvm-auto-ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}