This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:ruby_on_rails [2011/04/30 13:36] – created clemens | tutorials:ruby_on_rails [2012/05/01 20:12] (current) – ivan | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Content ===== | ===== Content ===== | ||
- | * [[#whatisrails|What is Rails?]] | + | * [[#What is Rails?]] |
- | * [[#prerequisites|Prerequisites]] | + | * [[# |
- | * [[#starting|Getting started]] | + | * [[#Getting started]] |
- | * [[#hello|Hello, world!]] | + | * [[#Hello, world of Rails!]] |
- | * [[#maintenance|Maintenance and Utility Scripts]] | + | * [[# |
---- | ---- | ||
- | ===== [[|What is Rails?]] ===== | + | ===== What is Rails? ===== |
[[http:// | [[http:// | ||
- | ===== [[|Prerequisites]] ===== | + | ===== Prerequisites ===== |
* You must be a MetaARPA member to use Rails (see [[http:// | * You must be a MetaARPA member to use Rails (see [[http:// | ||
Line 22: | Line 22: | ||
===== Getting started ===== | ===== Getting started ===== | ||
- | **Step 1:** Run "mkhomepg" | + | **Step 1:** Run '' |
**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/ | $ ruby $HOME/ | ||
- | =& | + | => Booting WEBrick... |
- | =& | + | => Rails application started on http:// |
- | =& | + | => Ctrl-C to shutdown server; call with --help for options |
</ | </ | ||
- | Then point your browser at " | + | Then point your browser at " |
- | ===== [[|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, | 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, | ||
Line 140: | Line 140: | ||
< | < | ||
- | class SayController | + | class SayController |
end | end | ||
</ | </ | ||
Line 149: | Line 149: | ||
< | < | ||
- | class SayController | + | class SayController |
def hello | def hello | ||
end | end | ||
Line 159: | Line 159: | ||
It might be annoying, but the error is perfectly reasonable (apart from the weird path). We created the controller class and the action method, but we haven' | It might be annoying, but the error is perfectly reasonable (apart from the weird path). We created the controller class and the action method, but we haven' | ||
- | <html& | + | < |
- | & | + | <html><head><title>Hello, Rails!</title></head> <body> |
+ | <h1>Hello from Rails and SDF!</h1> </body> </html> | ||
+ | </ | ||
Save the file hello.rhtml, | Save the file hello.rhtml, | ||
- | ===== [[|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 // | 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 // | ||
Line 178: | 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, | ||
+ |