I wanted to implement my operators web site using ror.(Ruby on rails)
I have follow the following guides in order to create the Skelton for the website:
http://guides.rubyonrails.org/getting_started.html
http://rubyinstaller.org/downloads
Currently just for the beginning I use SQllite3
Create the web site: rails new operators
Create afirst controller :
rails generate controller home index
Start the rails web server :railes server
Removed the default Index page :rm public/index.html
Update the default navigation to my new controller :
1: Operator::Application.routes.draw do
2: root :to => "home#index"
The code for the controller
The controller found in: \operators\app\controllers\application_controller.rb
1: class Operator
2: def initialize()
3: @mName = "-"
4: end
5: def Name
6: @mName7: end
8: def Name=(pValue)
9: @mName = pValue10: end
11:12: end
13: class HomeController < ApplicationController
14: def index
15: @theOperator = Operator.new16: @theOperator.Name = 'Zvika'17: end
18: end
The view :
Found in \operators\app\views\home\index.html.erb
<h1>Operators </h1>
<p>Operator: <%= @theOperator.Name %></p>
Navigate to the default home page:http://localhost:3000/
The Result:
אין תגובות:
הוסף רשומת תגובה