Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorials:ruby_on_rails [2011/04/30 21:05] – [[[|Hello, world of Rails!]]] georgtutorials:ruby_on_rails [2011/10/04 18:20] – Fix Formatting: Toc, <> memnon
Line 3: Line 3:
 ===== Content ===== ===== Content =====
  
-  * [[#whatisrails|What is Rails?]] +  * [[#What is Rails?]] 
-  * [[#prerequisites|Prerequisites]] +  * [[#Prerequisites]] 
-  * [[#starting|Getting started]] +  * [[#Getting started]] 
-  * [[#hello|Hello, world!]] +  * [[#Hello, world of Rails!]] 
-  * [[#maintenance|Maintenance and Utility Scripts]]+  * [[#Maintenance and Utility Scripts]]
  
 ---- ----
  
-===== [[|What is Rails?]] =====+===== What is Rails? =====
  
 [[http://www.rubyonrails.org/|Ruby on Rails]] is a WebDev framework written in the [[http://www.ruby-lang.org/|Ruby]] programming language. [[http://www.rubyonrails.org/|Ruby on Rails]] is a WebDev framework written in the [[http://www.ruby-lang.org/|Ruby]] programming language.
  
-===== [[|Prerequisites]] =====+===== Prerequisites =====
  
   * You must be a MetaARPA member to use Rails (see [[http://sdf.lonestar.org/index.cgi?access|memberships]] page).   * You must be a MetaARPA member to use Rails (see [[http://sdf.lonestar.org/index.cgi?access|memberships]] page).
Line 113: Line 113:
   - or -   - or -
   $ ruby $HOME/html/rails/my_first_project/script/server -p `id -u`   $ ruby $HOME/html/rails/my_first_project/script/server -p `id -u`
-  =&gt; Booting WEBrick... +  =Booting WEBrick... 
-  =&gt; Rails application started on http://0.0.0.0:60844 +  =Rails application started on http://0.0.0.0:60844 
-  =&gt; Ctrl-C to shutdown server; call with --help for options+  =Ctrl-C to shutdown server; call with --help for options
 </code> </code>
  
-Then point your browser at "http://yourdomain:&lt;YOUR UID&gt;" You should now be looking at the default 'Welcome to Rails page'. Now you can begin to develop your rails app.+Then point your browser at "http://yourdomain:<YOUR UID>" You should now be looking at the default 'Welcome to Rails page'. Now you can begin to develop your rails app.
  
-===== [[|Hello, world of Rails!]] =====+===== Hello, world of Rails! =====
  
 Rails is a Model-View-Controller framework. Rails accepts incoming requests from a browser, decodes the request to a controller, and calls an action method in that controller. The controller then invokes a particular view to display the results to the user. The good news is that Rails takes care of most of the internal plumbing that links all these actions. To write our simple Hello, World! application, we need code for a controller and a view. We don't need code for a model, because we're not dealing with any data. Let's start with the controller. Rails is a Model-View-Controller framework. Rails accepts incoming requests from a browser, decodes the request to a controller, and calls an action method in that controller. The controller then invokes a particular view to display the results to the user. The good news is that Rails takes care of most of the internal plumbing that links all these actions. To write our simple Hello, World! application, we need code for a controller and a view. We don't need code for a model, because we're not dealing with any data. Let's start with the controller.
Line 140: Line 140:
  
 <code> <code>
-  class SayController &lt; ApplicationController+  class SayController ApplicationController
   end   end
 </code> </code>
Line 149: Line 149:
  
 <code> <code>
-  class SayController &lt; ApplicationController+  class SayController ApplicationController
      def hello      def hello
      end      end
Line 166: Line 166:
 Save the file hello.rhtml, and refresh your browser window. You should see it display our friendly greeting. Notice that we didn't have to restart the application to see the update. During development, Rails automatically integrates changes into the running application as you save files. Save the file hello.rhtml, and refresh your browser window. You should see it display our friendly greeting. Notice that we didn't have to restart the application to see the update. During development, Rails automatically integrates changes into the running application as you save files.
  
-===== [[|Maintenance and Utility Scripts]] =====+===== Maintenance and Utility Scripts =====
  
 There are currently two main scripts that MetaARPA members can run to manage their RoR instance. The first is //ror// which is used to toggle automatic startup of your RoR instance upon system boot. The second is //railsctl// which allows you to //start//, //stop// and //restart// your RoR instance. There are currently two main scripts that MetaARPA members can run to manage their RoR instance. The first is //ror// which is used to toggle automatic startup of your RoR instance upon system boot. The second is //railsctl// which allows you to //start//, //stop// and //restart// your RoR instance.
Line 180: Line 180:
  
 // Note: if you do not see metaARPA here you're not in the metaARPA group and Rails won't work for you. // Note: if you do not see metaARPA here you're not in the metaARPA group and Rails won't work for you.
 +