Update 2021: Works with Rails 7 alpha

Setup your app directory

mkdir rails-edge-test-app
cd rails-edge-test-app

Specify your Ruby version

For example, substitute ruby-3.0.1 in here:

touch .ruby-version
echo 'ruby-x.y.z' > .ruby-version

Setup Gemfile with edge rails

Again substitute ‘x.y.z’ with your latest ruby version:

touch Gemfile
printf "source 'https://rubygems.org'\nruby 'x.y.z'\n\n\ngem 'rails', github: 'rails/rails'" >> Gemfile
bundle

Use rails generators to create new app, and run server

bundle exec rails new . --dev --force
bundle exec rails s