-
Notifications
You must be signed in to change notification settings - Fork 0
02 Setup
Dave Strus edited this page Nov 13, 2014
·
2 revisions
Rails 4.2 has introduced a bin/setup
file designed to be the canonical place to add code related to getting a project setup. Let's look at it for a bit.
$ bin/setup
It may complain that schema.rb doesn't exist yet, and that you should run bin/rake db:migrate
. If so, run that, and run bin/setup
again.
$ bin/rake db:migrate
$ bin/setup
Run RAILS_ENV=test bin/setup
to also setup the test database.
$ RAILS_ENV=test bin/setup
Add the Ruby version to the Gemfile
and check the Rails version.
ruby '2.1.4'
gem 'rails', '4.2.0.beta4'
And add a .ruby-version
file to match.
echo '2.1.4' > .ruby-version
Re-navigate to the current directory to make sure your Ruby switcher (RVM/Rbenv/Chruby) picks it up.
cd .
ruby --version
Let's fire up the server in a new tab and check it out.
bin/rails s
Now check out http://localhost:3000
in a browser, and you should see a default Rails page.
Commit.
git add .
git commit -m "Specify Ruby version for this app"