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 do2: root :to => "home#index"
The code for the controller
The controller found in: \operators\app\controllers\application_controller.rb
1: class Operator2: def initialize()3: @mName = "-"4: end5: def Name6: @mName7: end8: def Name=(pValue)9: @mName = pValue10: end11:12: end13: class HomeController < ApplicationController14: def index15: @theOperator = Operator.new16: @theOperator.Name = 'Zvika'17: end18: 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:
אין תגובות:
הוסף רשומת תגובה