Installing Rails 2.5.0 on Mac OS High Sierra

Since I've just switched to my new laptop running High Sierra, I thought it would be good to update my rails software. The latest version is 2.5.0. I downloaded it and compiled it and got an error message when I tried to install rails.

yo:~ $ gem install rails
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

I'm using macports, so I installed openssl with:

sudo port install openssl

Then I had to play around a bit to get the ruby installation to find this openssl. The winning command turned out to be:

yo:ruby-2.5.0 $ ./configure --prefix=/Users/maryh/Software/rubies/2.5.0 --with-opt-dir=/opt/local
yo:ruby-2.5.0 $ make
yo:ruby-2.5.0 $ make install