Common Steps To Start A Rails Project
Overview
Basic steps to start a rails app that will be hosted in a remote server and heroku, using sqlite3 in development and PostgreSQL in production (heroku).
Generate a new app
$ rails _5.0.0_ new sample_app
Adjust Gemfile
Inspect /sample_app/Gemfile
and put sqlite3
in the development
group
and postgresql
in production
group.
#...
group :development, :test do
gem 'sqlite3', '1.3.11'
#...
end
group :production do
gem 'pg', '0.18.4'
end
Install gems
Install the gems specified in development
, skipping production
gems with bundle install –without production.
$ cd sample_app sample_app$ bundle install --without production sample_app$ bundle update
Initialize Git repository
Start control versioning the project
sample_app$ git init sample_app$ git commit -m "Init repo"
Add Github repo
Set a new remote to github
sample_app$ git remote add origin https://github.com/user/sample_app.git sample_app$ git push -u origin --all
Deploy to Heroku
Pushing and deploying the application to Heroku.
sample_app$ heroku create sample_app$ git push heroku master
Useful commands
Migrating the database.
sample_app$ rails db:migrate
Running the test suite to verify that everything is working.
sample_app$ rails test
Run the app in a local server:
sample_app$ rails server
comments powered by Disqus
- The Idiomatically Correct Way To Make An Instance Of A Many To One Relationship ModelAugust 18, 2016
- Simple Debugging In RailsAugust 12, 2016
- Common Steps To Start A Rails Project
- Building A Hello World App In Ruby On Rails AppAugust 7, 2016
- Ruby On Rails OverviewAugust 7, 2016
Articles
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 . Terms and Policy.
Powered by SimpleIT Hugo Theme
·