Rails 4 Migration Tips

Regexp to convert from plain scope to proc in RubyMine

From:

, *where(.*)$

To

, -> { where$1 }

NOTE: Review the results. This Regexp does not handle comments on the ends of the scope lines, or additional params.

Running Specs

  1. Run the rspec with param -b to see the full stack trace. You often need this!
  2. Getting very good at the pry debugger is worth the effort.
  3. Sometimes you need to run the same test on both your Rails 3 and your Rails 4 branch to find where the tests start diverging.
  4. Often the place where you see the error is long past where the error began. So you have to be a detective and track down the error.