Similar to the previous question, whenever generating a new rails app the first things we end up doing are switching the database settings to use Postgres, replacing test-unit with rspec, and removing Turbolinks. Is there any way to automate all of this?
We can use the ~/.railsrc
file to configure a set of default arguments we
want used whenever we run rails new
. The following is an example railsrc
file that alters some defaults:
--skip-test-unit
--skip-bundle
--database=postgresql
--skip-turbolinks
We can use any options that could be used with the rails new
command in our
~/.railsrc
file. Run rails new --help
to see the full list of arguments.
If you're looking for a more full featured Rails app generator then be sure to check out [Suspenders][], our app generator that handles all of the above and also updates the Gemfile, configures the stylesheets to our liking, pre-configures [Hound][] and [CircleCI][], and a whole bunch more.
[Suspenders]: https://github.com/thoughtbot/suspenders [CircleCI]: https://circleci.com/ [Hound]: https://houndci.com/
Return to Flashcard Results