Postgres Command Info

? - list of postgres commands
\h - list of SQL commands
\h select(or whatever) - documentation on a specific command

The difference between <% and <%= in erb

(The distinction between the two types of embedded Ruby is that <% ... %> executes the code inside, while <%= ... %> executes it and inserts the result into the template.)

Capybara and RSpec testing

visit '/static_pages/home'
expect(page).to have_content('Sample App')

Visit simulates visiting the website (provided by capybara), and capybara also gives us a page variable.

Generate an integration test / request spec

$ rails generate integration_test static_pages

Rails switch from PUT to PATCH

By the way, previous versions of Rails used PUT in place of PATCH, and Rails 4.0 still supports this usage, but PATCH matches the intended HTTP usage better and is preferred for new applications.

Undo a single migration step:

$ rake db:rollback

Markdown line breaks

If you want to make a line break in markdown, you have to leave two or more spaces, then hit enter.
Like this, see?

Easy.

Destroying not only a new controller, but also any contingent files created by a generate command

$ rails generate controller FooBars baz quux

is rolled back with:

$ rails destroy  controller FooBars baz quux

$ rails new sample_app --skip-test-unit

Create a new rails app without the default unit tests directory.