Monday, May 26, 2014

First Ruby on Rails Application.

The first thing you need to do is to make sure you have everything installed on your Linux box.  On my older Ubuntu box this involved running the command:
sudo apt-get install ruby rails sqlite3 libsqlite3-rails 
Then I ran the following commands:
mkdir RubyOnRailsApps
cd RubyOnRailsApps
rails FirstApp
cd FirstApp/
./script/generate controller Say
vi app/controllers/say_controller.rb 
  And make the file look like:  
  class SayController < ApplicationController
    def hello   

vi app/views/say/hello.rhtml
  And make the file look like: 
       <title> First Ruby On Rails App! </title>    
       Hello World!    
Finally, start the server like this:
Then type this into your web browser:
And you should see the following;

No comments:

Post a Comment