Generate an application with a specific Rails version
Ok, so you are using rbenv
to manage multiple ruby versions in your system. What if you want to create, let's say, both Rails 4.0 and Rails 3.2 applications using the same ruby version?
Instead of installing Rails with the command gem install ...
we will use Bundler. How?
mkdir app
cd app
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rails', '3.2.17'" >> Gemfile
bundle install
So now we have a minimal project with Rails 3.2.17 bundled. Now, we can use the rails
command line tool with bundle exec
to force the version:
bundle exec rails new . --force --skip-bundle
bundle update
Many thanks to Michael Trojanek (http://www.relativkreativ.at/articles/managing-multiple-rails-versions) who pointed me to the Right Way™.
Written by Pablo Torrecilla
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#