Hello World from OSS Silicon Valley


HowToUse/RubyOnRails/4.1

#contents

*Install&Setup [#y05d363e]
: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 [#p499ff68]
: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/
#ref(CreateApplication_fig1.png,,500x266,)

: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(CreateApplication_fig2.png,,500x266,)


*Contributer [#la69134c]
S.Yatsuzuka