mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix READMEs (closes #2680) [coffee2code]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2908 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
3c8d425bb2
commit
6ab9f2bb40
4 changed files with 32 additions and 31 deletions
|
@ -24,14 +24,14 @@ ActiveRecord[http://activerecord.rubyonrails.org] (an object-relational
|
|||
mapping package), but that doesn't mean that Action Pack depends on Active
|
||||
Record. Action Pack is an independent package that can be used with any sort
|
||||
of backend (Instiki[http://www.instiki.org], which is based on an older version
|
||||
of Action Pack, uses Madeleine for example). Read more about the role Action
|
||||
of Action Pack, used Madeleine for example). Read more about the role Action
|
||||
Pack can play when used together with Active Record on
|
||||
http://www.rubyonrails.org.
|
||||
|
||||
A short rundown of the major features:
|
||||
|
||||
* Actions grouped in controller as methods instead of separate command objects
|
||||
and can therefore helper share methods.
|
||||
and can therefore share helper methods.
|
||||
|
||||
BlogController < ActionController::Base
|
||||
def display
|
||||
|
@ -103,15 +103,15 @@ A short rundown of the major features:
|
|||
def list
|
||||
# Before this action is run, the user will be authenticated, the cache
|
||||
# will be examined to see if a valid copy of the results already
|
||||
# exist, and the action will be logged for auditing.
|
||||
# exists, and the action will be logged for auditing.
|
||||
|
||||
# After this action has run, the output will first be localized then
|
||||
# compressed to minimize bandwith usage
|
||||
# compressed to minimize bandwidth usage
|
||||
end
|
||||
|
||||
private
|
||||
def authenticate
|
||||
# Implement the filter will full access to both request and response
|
||||
# Implement the filter with full access to both request and response
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -316,7 +316,7 @@ A short rundown of the major features:
|
|||
|
||||
<%= form "post" %>
|
||||
|
||||
...will generate something like (the selects will have more options of
|
||||
...will generate something like (the selects will have more options, of
|
||||
course):
|
||||
|
||||
<form action="create" method="POST">
|
||||
|
@ -413,7 +413,7 @@ And the templates look like this:
|
|||
|
||||
This simple setup will list all the posts in the system on the index page,
|
||||
which is called by accessing /weblog/. It uses the form builder for the Active
|
||||
Record model to make the new screen, which in turns hand everything over to
|
||||
Record model to make the new screen, which in turn hands everything over to
|
||||
the create action (that's the default target for the form builder when given a
|
||||
new model). After creating the post, it'll redirect to the display page using
|
||||
an URL such as /weblog/display/5 (where 5 is the id of the post).
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
= Active Record -- Object-relation mapping put on rails
|
||||
|
||||
Active Record connects business objects and database tables to create a persistable
|
||||
domain model where logic and data is presented in one wrapping. It's an implementation
|
||||
domain model where logic and data are presented in one wrapping. It's an implementation
|
||||
of the object-relational mapping (ORM) pattern[http://www.martinfowler.com/eaaCatalog/activeRecord.html]
|
||||
by the same name as described by Martin Fowler:
|
||||
|
||||
"An object that wraps a row in a database table or view, encapsulates
|
||||
the database access, and adds domain logic on that data."
|
||||
|
||||
Active Records main contribution to the pattern is to relieve the original of two stunting problems:
|
||||
Active Record's main contribution to the pattern is to relieve the original of two stunting problems:
|
||||
lack of associations and inheritance. By adding a simple domain language-like set of macros to describe
|
||||
the former and integrating the Single Table Inheritance pattern for the latter, Active Record narrows the
|
||||
gap of functionality between the data mapper and active record approach.
|
||||
|
@ -157,7 +157,7 @@ A short rundown of the major features:
|
|||
|
||||
pkId = 1234
|
||||
cat = Cat.find(pkId)
|
||||
# something even more interesting involving a the same cat...
|
||||
# something even more interesting involving the same cat...
|
||||
cat.save
|
||||
|
||||
{Learn more}[link:classes/ActiveRecord/Base.html]
|
||||
|
@ -189,7 +189,7 @@ A short rundown of the major features:
|
|||
|
||||
Data definitions are specified only in the database. Active Record queries the database for
|
||||
the column names (that then serves to determine which attributes are valid) on regular
|
||||
objects instantiation through the new constructor and relies on the column names in the rows
|
||||
object instantiation through the new constructor and relies on the column names in the rows
|
||||
with the finders.
|
||||
|
||||
# CREATE TABLE companies (
|
||||
|
@ -235,7 +235,7 @@ Active Record will also automatically link the "Person" object to the "people" t
|
|||
|
||||
== Simple example (2/2): Using the domain
|
||||
|
||||
Picking a database connection for all the active records
|
||||
Picking a database connection for all the Active Records
|
||||
|
||||
ActiveRecord::Base.establish_connection(
|
||||
:adapter => "mysql",
|
||||
|
@ -300,9 +300,9 @@ It's also highly recommended to have a look at the unit tests. Read more in link
|
|||
|
||||
== Philosophy
|
||||
|
||||
Active Record attempts to provide a coherent wrapping for the inconvenience that is
|
||||
Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is
|
||||
object-relational mapping. The prime directive for this mapping has been to minimize
|
||||
the amount of code needed to built a real-world domain model. This is made possible
|
||||
the amount of code needed to build a real-world domain model. This is made possible
|
||||
by relying on a number of conventions that make it easy for Active Record to infer
|
||||
complex relations and structures from a minimal amount of explicit direction.
|
||||
|
||||
|
@ -357,4 +357,4 @@ RubyForge page at http://rubyforge.org/projects/activerecord. And as Jim from Ra
|
|||
new feature to be submitted in the form of new unit tests.
|
||||
|
||||
For other information, feel free to ask on the ruby-talk mailing list
|
||||
(which is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
|
||||
(which is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
|
||||
|
|
|
@ -18,8 +18,8 @@ Documentation can be found at
|
|||
|
||||
== Installation
|
||||
|
||||
The prefered method of installing Active Support is through its GEM file. You'll need to have
|
||||
RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have,
|
||||
The preferred method of installing Active Support is through its GEM file. You'll need to have
|
||||
RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have it,
|
||||
then use:
|
||||
|
||||
% [sudo] gem install activesupport-1.0.0.gem
|
||||
|
@ -40,4 +40,4 @@ RubyForge page at http://rubyforge.org/projects/activesupport. And as Jim from R
|
|||
new feature to be submitted in the form of new unit tests.
|
||||
|
||||
For other information, feel free to ask on the ruby-talk mailing list
|
||||
(which is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
|
||||
(which is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
== Welcome to Rails
|
||||
|
||||
Rails is a web-application and persistance framework that includes everything
|
||||
Rails is a web-application and persistence framework that includes everything
|
||||
needed to create database-backed web-applications according to the
|
||||
Model-View-Control pattern of separation. This pattern splits the view (also
|
||||
called the presentation) into "dumb" templates that are primarily responsible
|
||||
for inserting pre-build data in between HTML tags. The model contains the
|
||||
for inserting pre-built data in between HTML tags. The model contains the
|
||||
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
||||
the business logic and knows how to persist themselves to a database. The
|
||||
controller handles the incoming requests (such as Save New Account, Update
|
||||
Product, Show Post) by manipulating the model and directing data to the view.
|
||||
|
||||
In Rails, the model is handled by what's called a object-relational mapping
|
||||
In Rails, the model is handled by what's called an object-relational mapping
|
||||
layer entitled Active Record. This layer allows you to present the data from
|
||||
database rows as objects and embellish these data objects with business logic
|
||||
methods. You can read more about Active Record in
|
||||
link:files/vendor/rails/activerecord/README.html.
|
||||
|
||||
The controller and view is handled by the Action Pack, which handles both
|
||||
The controller and view are handled by the Action Pack, which handles both
|
||||
layers by its two parts: Action View and Action Controller. These two layers
|
||||
are bundled in a single package due to their heavy interdependence. This is
|
||||
unlike the relationship between the Active Record and Action Pack that is much
|
||||
|
@ -49,9 +49,9 @@ link:files/vendor/rails/actionpack/README.html.
|
|||
</VirtualHost>
|
||||
|
||||
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
||||
should be on and ".cgi" should respond. All requests from 127.0.0.1 goes
|
||||
should be on and ".cgi" should respond. All requests from 127.0.0.1 go
|
||||
through CGI, so no Apache restart is necessary for changes. All other requests
|
||||
goes through FCGI (or mod_ruby) that requires restart to show changes.
|
||||
go through FCGI (or mod_ruby), which requires a restart to show changes.
|
||||
|
||||
|
||||
== Debugging Rails
|
||||
|
@ -101,7 +101,7 @@ Finally, when you're ready to resume execution, you press CTRL-D
|
|||
You can interact with the domain model by starting the console through script/console.
|
||||
Here you'll have all parts of the application configured, just like it is when the
|
||||
application is running. You can inspect domain models, change values, and save to the
|
||||
database. Start the script without arguments will launch it in the development environment.
|
||||
database. Starting the script without arguments will launch it in the development environment.
|
||||
Passing an argument will specify a different environment, like <tt>console production</tt>.
|
||||
|
||||
|
||||
|
@ -117,11 +117,11 @@ app/controllers
|
|||
|
||||
app/models
|
||||
Holds models that should be named like post.rb.
|
||||
Most models will descent from ActiveRecord::Base.
|
||||
Most models will descend from ActiveRecord::Base.
|
||||
|
||||
app/views
|
||||
Holds the template files for the view that should be named like
|
||||
weblog/index.rhtml for the WeblogController#index action. All views uses eRuby
|
||||
weblog/index.rhtml for the WeblogController#index action. All views use eRuby
|
||||
syntax. This directory can also be used to keep stylesheets, images, and so on
|
||||
that can be symlinked to public.
|
||||
|
||||
|
@ -132,14 +132,14 @@ config
|
|||
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
||||
|
||||
components
|
||||
Self-contained mini-applications that can bundle controllers, models, and views together.
|
||||
Self-contained mini-applications that can bundle together controllers, models, and views.
|
||||
|
||||
lib
|
||||
Application specific libraries. Basically, any kind of custom code that doesn't
|
||||
belong controllers, models, or helpers. This directory is in the load path.
|
||||
belong under controllers, models, or helpers. This directory is in the load path.
|
||||
|
||||
public
|
||||
The directory available for the web server. Contains sub-directories for images, stylesheets,
|
||||
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
||||
and javascripts. Also contains the dispatchers and the default HTML files.
|
||||
|
||||
script
|
||||
|
@ -149,4 +149,5 @@ test
|
|||
Unit and functional tests along with fixtures.
|
||||
|
||||
vendor
|
||||
External libraries that the application depend on. This directory is in the load path.
|
||||
External libraries that the application depends on. Also includes the plugins subdirectory.
|
||||
This directory is in the load path.
|
||||
|
|
Loading…
Reference in a new issue