Hello World from OSS Silicon Valley


HowToUse/RubyOnRails/4.1


_ Install&Setup

Step.1
Check if the rails has already been installed.
$ rails --version
Step.2
If the rails has not been installed yet, execute the following command
$ gem install rails

_ HowToUse

Step.1
Create new application.
$ rails new <Application Name>
Step.2
Launch application.
$ cd <Application Name>
$ rails server

In case you encounter the error message of "Could not find a JavaScript runtime.", execute the following commands.

$ gem install execjs
$ gem install therubyracer

Open the Gemfile and append the following lines.

$ vi Gemfile
gem ‘execjs’
gem ‘therubyracer’
$ bundle install
Step.3
Access the following page.
http://localhost:3000/
CreateApplication_fig1.png
Step.4
Create controller and view files.
$ rails generate controller <Controller Name> <Method(View)> <Method(View)>
(Example)
$ rails generate controller Say hello goodbye
Step.5
Access the following page.
http://localhost:3000/say/hello/

#ref(): File not found: "CreateApplication_fig2.png" at page "HowToUse/RubyOnRails/4.1"

_ Author

S.Yatsuzuka