In this tutorial, we will setup a basic ruby on rails web app, that consists of a /hello_world
and a /status
controller. The hello_world controller will return Hello, World
and our /status
controller will return a HTTP 204
no content response code.
Setup Ruby on Rails
Setup Ruby on Rails on your Mac:
1 2 3 4 5 6 7 8 9 10 11 |
|
Creating the App
Create your ruby on rails application:
1 2 3 |
|
Route Config
Our routes config:
1 2 3 4 5 6 |
|
Controllers
Configure the hello_world controller:
1 2 3 4 5 6 7 |
|
Configure the status controller:
1 2 3 4 5 6 7 |
|
Testing
For our hello world controller:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
For our status controller:
1 2 3 4 5 6 7 8 |
|
Resources:
- https://gorails.com/setup/osx/10.12-sierra
- http://guides.rubyonrails.org/routing.html
- https://www.railstutorial.org/book/beginning#sec-installing_rails
- https://www.railstutorial.org/book/toy_app
- http://codingnudge.com/2017/03/17/tutorial-how-to-run-ruby-on-rails-on-docker-part-1/
- https://medium.com/how-i-learned-ruby-rails/how-i-trained-to-learn-rails-e08c94e2a51e