Ask for Help
“A file is being loaded twice by Rails, and I’m not sure why. How do I figure out what’s reloading it?”
Try putting this at the top of the file:
puts caller
puts "-" * 80
#caller is a Kernel method which returns the backtrace at the time it’s called as an array of strings. Every time the file is loaded, you’ll see the backtrace of what loaded it. The second line makes a separator so you can see the break between stacktraces.
“Is there a command that will make a new file in a path of directories that don’t exist yet? Like
mkdir -pbut for files? Maybetouch -p?”
No. No one knows why.
Interesting Things
Chrome Tab Overview: Chrome can now show you an overview of all tabs in a window like Exposé does for windows. It’s an experimental feature. To enable it, go to , enable “Tab Overview”, and restart Chrome. Then three-finger swipe down to see all your tabs.
Your humble reporter reminds the reader that Camino pioneered the “Tabspose” feature in 2007.
ERROR: current transaction is aborted: On Postgres, sometimes RSpec will show the error “ERROR: current transaction is aborted, commands ignored until end of transaction block.” The backtrace of this error is not useful, because it’s the backtrace of the first operation to use the database connection after some error occurred. These errors are tricky to debug.
The people who hit it had luck with temporarily turning off
use_transactional_examplesin the RSpec config, which let them see the error. Just remember to turn it back on, because transactions keep your tests clean and fast. (Note:use_transactional_examplesanduse_transactional_fixturesare synonymous.)