You can find scripts such as Ruby on Rails sh to install the latest (September 12/2016) Ruby and Ruby on Rails.
Also, there's README on How to install Ruby on Rails on a Ubuntu Server or how to install Postgres and allow connections from outside, etc.