Default Ruby on Rails Options

A lot of times, we will create a new Ruby on Rails application and go through the process of our normal configuration setup. Sometimes, we will create a template to expedite our setup like in a recent screencast episode. https://www.driftingruby.com/episodes/templating-ruby-on-rails-applications

Other times, we will need to create a new Ruby on Rails application and we have a list of things that we want to skip. It can be annoying to remember or script out these things. When we create a new application, we can skip something like Turbolinks.

rails new testapp --skip-turbolinks

If this is a common occurrence, then this isn't something we want to have to remember every time. Luckily, there is a much easier way to make these kinds of changes a default. Create a file .railsrc in your home directory.

touch ~/.railsrc

Edit the file and paste in your overrides.

--skip-spring
--skip-test-unit
--skip-bundle
--skip-coffee

You can even set up defaults for webpack and a framework by adding the lines in the .railsrc file.

--skip-spring
--skip-test-unit
--skip-bundle
--skip-coffee
--webpack=vue

And it also works for database settings.

--skip-spring
--skip-test-unit
--skip-bundle
--skip-coffee
--webpack=vue
-d mysql