Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:ruby_on_rails [2011/04/30 21:06]
georg [[[|Hello, world of Rails!]]]
tutorials:ruby_on_rails [2012/05/01 20:12]
ivan
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 22: Line 22:
 ===== Getting started ===== ===== Getting started =====
  
-**Step 1:** Run "mkhomepg" ​if you have not already done so (see the [[http://​sdf.lonestar.org/​index.cgi?​tutorials/​building_a_website|building_a_website]] tutorial for more information on the "​mkhomepg"​ command).+**Step 1:** Run ''​mkhomepg'' ​if you have not already done so (see the [[http://​sdf.lonestar.org/​index.cgi?​tutorials/​building_a_website|building_a_website]] tutorial for more information on the "​mkhomepg"​ command).
  
 **Step 2:** Use the rails command to construct the base for your new rails application:​ **Step 2:** Use the rails command to construct the base for your new rails application:​
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 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.
 +
 +$Id: Ruby_on_Rails.html,​v 1.7 2006/12/29 06:54:24 phm Exp $
 +