cannot load such file -- tiny_tdsが出た時の対処法

tiny_tdsを使用しようとして下記メッセージが頻発しました。

lib/tiny_tds.rb:22:in `require': cannot load such file -- tiny_tds/tiny_tds (LoadError)

日本語サイトで取り扱っているページが少なく、初めはRailsのバージョンのせい(Rails5から始めてしまったため)かと思いバージョン管理のアレコレを調べ、Rails4.2.7.1で試しても状況は変わらず...。

厄介なのが、出るときと出ないときがありまた、
rails server コマンドや
rails generate controller コマンドなどでも発生したことです。
変更を加えて試す、トライアンドエラーを繰り返している最中に、エラーなしの時があるのは、勘違いをしやすく途中で何をやっているのかわからない状況になってきていました。


前置きが少し長めになりましたが、結果としては
config/boot.rb に対して require 'bundler/setup' の前に require 'tiny_tds' を追加することで発生しなくなりました。


参考
tiny_tds.so not a valid win32 application #290

require 'tiny_tds'
require 'bundler/setup'

Maybe there's a better file to put it in for Rails init but it seemed like
much after that and it would blow up. If I get time I might try to look at
what is happening with psych loading first but can't spend time on it
immediately.