I create a new Rails app remarkably often and over the years have found it difficult to remember my preferred options for rails new. The out-of-the-box experience of Rails has always been one of its strong points but I end up taking a lot out of a freshly created Rails project. I can’t believe it took me so long to discover ~/.railsrc, a file that stores your default preferences for rails new — it must have passed me by on its arrival years ago with Rails 3.2. From what I can gather this feature is also underutilised by other experienced Rails devs so it’s time to evangelise.
Some of my choices are purely personal preference but some are slightly more quantifiable and follow the principle that gems, configuration, and other files should enter a project when they serve a purpose instead of being added by default (on a related note I recently had a pull request merged to ensure that Uglifier isn’t added unnecessarily) — this seems to be the opposite approach to something like Suspenders which configures everything up-front.
Here are the current contents of my ~/.railsrc:
Heroku uses PostgreSQL. I use Heroku. I use PostgreSQL.
I haven’t tried Action Cable yet and am not sure where it fits into the way I typically apply “realtime” so until I find out I’ll continue using Pusher.
Sending email isn’t usually the initial functionality of an app, there’ll also be a bit of configuration to integrate with an email-sending service, so I choose to leave it all until then.
If I’m somewhere with no (or even worse, slow) internet I’d rather get on with writing code as soon as possible instead of waiting for my machine to notice it’s offline so I run bundle install — local which usually does the job.
If and when I want jQuery — or React, or something completely different like browserify — I’ll add it myself. (This also skips Turbolinks.)
I know where everything goes so the scattering of .keep files are just noise for me.
I’ve never actually used Spring.
After many years of actively disliking RSpec (!) it’s now my testing framework of choice. My first few commits of a project tend to be about validating an idea so I’ll add and configure rspec-rails later.
What am I missing?
Tweet me your ~/.railsrc preferences.
Originally published at www.benpickles.com