Rails Footnotes database count stays at zero

Published 10 March 2010

I use the Footnotes gem extensively for tracking database queries when developing Ruby on Rails applications.\r\n\r\nRecently this stopped working and I couldn’t figure out why, until I dug into the code and found this method:\r\n\r\n@@@ ruby\r\ndef self.include_when_new_relic_installed=(include_me)\r\n @include_when_new_relic_installed = include_me\r\n load if include_me\r\nend\r\n@\r\n \r\nHad I actually read all the configuration instructions on github it would have told me:\r\n\r\n@\r\nThe queries note by default will not load if it detects New Relic loaded in the app. If you want to load it\r\nin this case, add the following to an initializer:\r\n\r\nFootnotes::Notes::QueriesNote.include_when_new_relic_installed = true if defined?(Footnotes)\r\n@\r\n\r\nhowever strangely this didn't come up when I googled for a solution.\r\n\r\nNOTE: The instructions tell you to put this into an initializer, which is a key step. I was trying to include it in my environment.rb file but that doesn't work.\r\n\r\nSo I created a file called footnotes.rb in config/initializers which looks like this:\r\n\r\n@ ruby\r\nif defined?(Footnotes)\r\n Footnotes::Filter.prefix = 'txmt://open?url=file://%s&line=%d&column=%d'\r\n Footnotes::Notes::QueriesNote.include_when_new_relic_installed = true\r\nend\r\n@@\r\n\r\nFind this useful? Please leave a comment and \follow us on twitter\