You are probably using Ruby 1.8.7 with a too recent versions of Rubygems.
Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)
Downgrade your Rubygems to the latest version that works with 1.8.7.