public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fix READMEs (closes #2680) [coffee2code]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2908 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Mon Nov 07 01:51:47 -0800 2005
commit  6ab9f2bb407194ada0973301d55525ad79e1ff78
tree    d74228ddf0dc9c1f376ac3a44e3cbd04272a47d5
parent  3c8d425bb23db54f82b1e9711428d42d3922287d
...
24
25
26
27
 
28
29
30
31
32
33
34
 
35
36
37
38
39
...
103
104
105
106
 
107
108
109
 
110
111
112
113
114
 
115
116
117
...
316
317
318
319
 
320
321
322
...
413
414
415
416
 
417
418
419
...
24
25
26
 
27
28
29
30
31
32
33
 
34
35
36
37
38
39
...
103
104
105
 
106
107
108
 
109
110
111
112
113
 
114
115
116
117
...
316
317
318
 
319
320
321
322
...
413
414
415
 
416
417
418
419
0
@@ -24,14 +24,14 @@
0
 mapping package), but that doesn't mean that Action Pack depends on Active
0
 Record. Action Pack is an independent package that can be used with any sort
0
 of backend (Instiki[http://www.instiki.org], which is based on an older version
0
-of Action Pack, uses Madeleine for example). Read more about the role Action
0
+of Action Pack, used Madeleine for example). Read more about the role Action
0
 Pack can play when used together with Active Record on
0
 http://www.rubyonrails.org.
0
 
0
 A short rundown of the major features:
0
 
0
 * Actions grouped in controller as methods instead of separate command objects
0
- and can therefore helper share methods.
0
+ and can therefore share helper methods.
0
 
0
     BlogController < ActionController::Base
0
       def display
0
0
0
@@ -103,15 +103,15 @@
0
       def list
0
         # Before this action is run, the user will be authenticated, the cache
0
         # will be examined to see if a valid copy of the results already
0
- # exist, and the action will be logged for auditing.
0
+ # exists, and the action will be logged for auditing.
0
         
0
         # After this action has run, the output will first be localized then
0
- # compressed to minimize bandwith usage
0
+ # compressed to minimize bandwidth usage
0
       end
0
       
0
       private
0
         def authenticate
0
- # Implement the filter will full access to both request and response
0
+ # Implement the filter with full access to both request and response
0
         end
0
     end
0
   
0
@@ -316,7 +316,7 @@
0
 
0
     <%= form "post" %>
0
     
0
- ...will generate something like (the selects will have more options of
0
+ ...will generate something like (the selects will have more options, of
0
     course):
0
     
0
     <form action="create" method="POST">
0
@@ -413,7 +413,7 @@
0
   
0
 This simple setup will list all the posts in the system on the index page,
0
 which is called by accessing /weblog/. It uses the form builder for the Active
0
-Record model to make the new screen, which in turns hand everything over to
0
+Record model to make the new screen, which in turn hands everything over to
0
 the create action (that's the default target for the form builder when given a
0
 new model). After creating the post, it'll redirect to the display page using
0
 an URL such as /weblog/display/5 (where 5 is the id of the post).
...
1
2
3
4
 
5
6
7
8
9
10
11
 
12
13
14
...
157
158
159
160
 
161
162
163
...
189
190
191
192
 
193
194
195
...
235
236
237
238
 
239
240
241
242
...
300
301
302
303
 
304
305
 
306
307
308
...
1
2
3
 
4
5
6
7
8
9
10
 
11
12
13
14
...
157
158
159
 
160
161
162
163
...
189
190
191
 
192
193
194
195
...
235
236
237
 
238
239
240
241
242
...
300
301
302
 
303
304
 
305
306
307
308
0
@@ -1,14 +1,14 @@
0
 = Active Record -- Object-relation mapping put on rails
0
 
0
 Active Record connects business objects and database tables to create a persistable
0
-domain model where logic and data is presented in one wrapping. It's an implementation
0
+domain model where logic and data are presented in one wrapping. It's an implementation
0
 of the object-relational mapping (ORM) pattern[http://www.martinfowler.com/eaaCatalog/activeRecord.html]
0
 by the same name as described by Martin Fowler:
0
 
0
   "An object that wraps a row in a database table or view, encapsulates
0
        the database access, and adds domain logic on that data."
0
 
0
-Active Records main contribution to the pattern is to relieve the original of two stunting problems:
0
+Active Record's main contribution to the pattern is to relieve the original of two stunting problems:
0
 lack of associations and inheritance. By adding a simple domain language-like set of macros to describe
0
 the former and integrating the Single Table Inheritance pattern for the latter, Active Record narrows the
0
 gap of functionality between the data mapper and active record approach.
0
@@ -157,7 +157,7 @@
0
 
0
      pkId = 1234
0
      cat = Cat.find(pkId)
0
- # something even more interesting involving a the same cat...
0
+ # something even more interesting involving the same cat...
0
      cat.save
0
 
0
   {Learn more}[link:classes/ActiveRecord/Base.html]
0
@@ -189,7 +189,7 @@
0
 
0
 Data definitions are specified only in the database. Active Record queries the database for
0
 the column names (that then serves to determine which attributes are valid) on regular
0
-objects instantiation through the new constructor and relies on the column names in the rows
0
+object instantiation through the new constructor and relies on the column names in the rows
0
 with the finders.
0
  
0
    # CREATE TABLE companies (
0
@@ -235,7 +235,7 @@
0
 
0
 == Simple example (2/2): Using the domain
0
 
0
-Picking a database connection for all the active records
0
+Picking a database connection for all the Active Records
0
 
0
    ActiveRecord::Base.establish_connection(
0
      :adapter => "mysql",
0
0
@@ -300,9 +300,9 @@
0
 
0
 == Philosophy
0
 
0
-Active Record attempts to provide a coherent wrapping for the inconvenience that is
0
+Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is
0
 object-relational mapping. The prime directive for this mapping has been to minimize
0
-the amount of code needed to built a real-world domain model. This is made possible
0
+the amount of code needed to build a real-world domain model. This is made possible
0
 by relying on a number of conventions that make it easy for Active Record to infer
0
 complex relations and structures from a minimal amount of explicit direction.
0
 
...
18
19
20
21
22
 
 
23
24
25
...
18
19
20
 
 
21
22
23
24
25
0
@@ -18,8 +18,8 @@
0
 
0
 == Installation
0
 
0
-The prefered method of installing Active Support is through its GEM file. You'll need to have
0
-RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have,
0
+The preferred method of installing Active Support is through its GEM file. You'll need to have
0
+RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have it,
0
 then use:
0
 
0
   % [sudo] gem install activesupport-1.0.0.gem
...
1
2
3
 
4
5
6
7
 
8
9
10
11
12
13
 
14
15
16
17
18
19
 
20
21
22
23
...
49
50
51
52
 
53
54
 
55
56
57
...
101
102
103
104
 
105
106
107
108
...
117
118
119
120
 
121
122
123
124
 
125
126
127
128
129
...
132
133
134
135
 
136
137
138
139
 
140
141
142
 
143
144
145
...
149
150
151
152
 
 
...
1
2
 
3
4
5
6
 
7
8
9
10
11
12
 
13
14
15
16
17
18
 
19
20
21
22
23
...
49
50
51
 
52
53
 
54
55
56
57
...
101
102
103
 
104
105
106
107
108
...
117
118
119
 
120
121
122
123
 
124
125
126
127
128
129
...
132
133
134
 
135
136
137
138
 
139
140
141
 
142
143
144
145
...
149
150
151
 
152
153
0
@@ -1,22 +1,22 @@
0
 == Welcome to Rails
0
 
0
-Rails is a web-application and persistance framework that includes everything
0
+Rails is a web-application and persistence framework that includes everything
0
 needed to create database-backed web-applications according to the
0
 Model-View-Control pattern of separation. This pattern splits the view (also
0
 called the presentation) into "dumb" templates that are primarily responsible
0
-for inserting pre-build data in between HTML tags. The model contains the
0
+for inserting pre-built data in between HTML tags. The model contains the
0
 "smart" domain objects (such as Account, Product, Person, Post) that holds all
0
 the business logic and knows how to persist themselves to a database. The
0
 controller handles the incoming requests (such as Save New Account, Update
0
 Product, Show Post) by manipulating the model and directing data to the view.
0
 
0
-In Rails, the model is handled by what's called a object-relational mapping
0
+In Rails, the model is handled by what's called an object-relational mapping
0
 layer entitled Active Record. This layer allows you to present the data from
0
 database rows as objects and embellish these data objects with business logic
0
 methods. You can read more about Active Record in
0
 link:files/vendor/rails/activerecord/README.html.
0
 
0
-The controller and view is handled by the Action Pack, which handles both
0
+The controller and view are handled by the Action Pack, which handles both
0
 layers by its two parts: Action View and Action Controller. These two layers
0
 are bundled in a single package due to their heavy interdependence. This is
0
 unlike the relationship between the Active Record and Action Pack that is much
0
0
@@ -49,9 +49,9 @@
0
   </VirtualHost>
0
 
0
 NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
0
-should be on and ".cgi" should respond. All requests from 127.0.0.1 goes
0
+should be on and ".cgi" should respond. All requests from 127.0.0.1 go
0
 through CGI, so no Apache restart is necessary for changes. All other requests
0
-goes through FCGI (or mod_ruby) that requires restart to show changes.
0
+go through FCGI (or mod_ruby), which requires a restart to show changes.
0
 
0
 
0
 == Debugging Rails
0
@@ -101,7 +101,7 @@
0
 You can interact with the domain model by starting the console through script/console.
0
 Here you'll have all parts of the application configured, just like it is when the
0
 application is running. You can inspect domain models, change values, and save to the
0
-database. Start the script without arguments will launch it in the development environment.
0
+database. Starting the script without arguments will launch it in the development environment.
0
 Passing an argument will specify a different environment, like <tt>console production</tt>.
0
 
0
 
0
0
@@ -117,11 +117,11 @@
0
 
0
 app/models
0
   Holds models that should be named like post.rb.
0
- Most models will descent from ActiveRecord::Base.
0
+ Most models will descend from ActiveRecord::Base.
0
   
0
 app/views
0
   Holds the template files for the view that should be named like
0
- weblog/index.rhtml for the WeblogController#index action. All views uses eRuby
0
+ weblog/index.rhtml for the WeblogController#index action. All views use eRuby
0
   syntax. This directory can also be used to keep stylesheets, images, and so on
0
   that can be symlinked to public.
0
   
0
0
0
@@ -132,14 +132,14 @@
0
   Configuration files for the Rails environment, the routing map, the database, and other dependencies.
0
 
0
 components
0
- Self-contained mini-applications that can bundle controllers, models, and views together.
0
+ Self-contained mini-applications that can bundle together controllers, models, and views.
0
 
0
 lib
0
   Application specific libraries. Basically, any kind of custom code that doesn't
0
- belong controllers, models, or helpers. This directory is in the load path.
0
+ belong under controllers, models, or helpers. This directory is in the load path.
0
     
0
 public
0
- The directory available for the web server. Contains sub-directories for images, stylesheets,
0
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
0
   and javascripts. Also contains the dispatchers and the default HTML files.
0
 
0
 script
0
@@ -149,5 +149,6 @@
0
   Unit and functional tests along with fixtures.
0
 
0
 vendor
0
- External libraries that the application depend on. This directory is in the load path.
0
+ External libraries that the application depends on. Also includes the plugins subdirectory.
0
+ This directory is in the load path.

Comments

    No one has commented yet.