Skip to content

Instantly share code, notes, and snippets.

@yihangho
Last active May 9, 2016 13:58
Show Gist options
  • Save yihangho/3e130568ed8cb7cfc454d38849a89fd9 to your computer and use it in GitHub Desktop.
Save yihangho/3e130568ed8cb7cfc454d38849a89fd9 to your computer and use it in GitHub Desktop.
Rails Best Practice
  1. master branch is always deployable.
  2. Cut a new branch off master whenever working on something new.
  3. When you're ready, either merge the feature branch back into master or make a PR if you want your code reviewed.
  4. Commit and push often.
  5. Source code is always open-sourceable (i.e., do not commit API keys, private keys, etc).
    • API keys: use environment variables (set them in .bashrc or .zshrc).
    • Private keys: ignore using .gitignore.
  6. Always write tests. If possible, make the tests as comprehensive as possible. Otherwise, treat them as sanity tests (i.e., to make sure nothing is obviously broken).
  7. Whenever a bug is discovered, write test for it before fixing it (i.e., practice TDD when shit hits the fan).
  8. Use only the seven default actions (index, new, create, show, edit, update, destroy) in controllers. DHH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment