aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb2
-rw-r--r--activerecord/lib/active_record/reflection.rb58
-rw-r--r--railties/guides/source/command_line.textile12
3 files changed, 37 insertions, 35 deletions
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index be7448ce01..b0eb24a4a8 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -63,7 +63,7 @@ module ActionController
# def test_access_granted_from_xml
# get(
# "/notes/1.xml", nil,
- # :authorization => ActionController::HttpAuthentication::Basic.encode_credentials(users(:dhh).name, users(:dhh).password)
+ # 'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(users(:dhh).name, users(:dhh).password)
# )
#
# assert_equal 200, status
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 09d7f8699e..03a932f642 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -3,14 +3,14 @@ module ActiveRecord
module Reflection # :nodoc:
extend ActiveSupport::Concern
- # Reflection allows you to interrogate Active Record classes and objects
+ # Reflection enables to interrogate Active Record classes and objects
# about their associations and aggregations. This information can,
- # for example, be used in a form builder that took an Active Record object
- # and created input fields for all of the attributes depending on their type
- # and displayed the associations to other objects.
+ # for example, be used in a form builder that takes an Active Record object
+ # and creates input fields for all of the attributes depending on their type
+ # and displays the associations to other objects.
#
- # You can find the interface for the AggregateReflection and AssociationReflection
- # classes in the abstract MacroReflection class.
+ # MacroReflection class has info for AggregateReflection and AssociationReflection
+ # classes.
module ClassMethods
def create_reflection(macro, name, options, active_record)
case macro
@@ -24,7 +24,7 @@ module ActiveRecord
reflection
end
- # Returns a hash containing all AssociationReflection objects for the current class
+ # Returns a hash containing all AssociationReflection objects for the current class.
# Example:
#
# Invoice.reflections
@@ -39,9 +39,9 @@ module ActiveRecord
reflections.values.select { |reflection| reflection.is_a?(AggregateReflection) }
end
- # Returns the AggregateReflection object for the named +aggregation+ (use the symbol). Example:
+ # Returns the AggregateReflection object for the named +aggregation+ (use the symbol).
#
- # Account.reflect_on_aggregation(:balance) # returns the balance AggregateReflection
+ # Account.reflect_on_aggregation(:balance) #=> the balance AggregateReflection
#
def reflect_on_aggregation(aggregation)
reflections[aggregation].is_a?(AggregateReflection) ? reflections[aggregation] : nil
@@ -78,8 +78,7 @@ module ActiveRecord
end
- # Abstract base class for AggregateReflection and AssociationReflection that
- # describes the interface available for both of those classes. Objects of
+ # Abstract base class for AggregateReflection and AssociationReflection. Objects of
# AggregateReflection and AssociationReflection are returned by the Reflection::ClassMethods.
class MacroReflection
attr_reader :active_record
@@ -89,36 +88,41 @@ module ActiveRecord
end
# Returns the name of the macro.
- # <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>:balance</tt>
- # <tt>has_many :clients</tt> will return <tt>:clients</tt>
+ #
+ # <tt>composed_of :balance, :class_name => 'Money'</tt> returns <tt>:balance</tt>
+ # <tt>has_many :clients</tt> returns <tt>:clients</tt>
def name
@name
end
# Returns the macro type.
- # <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>:composed_of</tt>
- # <tt>has_many :clients</tt> will return <tt>:has_many</tt>
+ #
+ # <tt>composed_of :balance, :class_name => 'Money'</tt> returns <tt>:composed_of</tt>
+ # <tt>has_many :clients</tt> returns <tt>:has_many</tt>
def macro
@macro
end
# Returns the hash of options used for the macro.
- # <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>{ :class_name => "Money" }</tt>
- # <tt>has_many :clients</tt> will return +{}+
+ #
+ # <tt>composed_of :balance, :class_name => 'Money'</tt> returns <tt>{ :class_name => "Money" }</tt>
+ # <tt>has_many :clients</tt> returns +{}+
def options
@options
end
# Returns the class for the macro.
- # <tt>composed_of :balance, :class_name => 'Money'</tt> will return the Money class
- # <tt>has_many :clients</tt> will return the Client class
+ #
+ # <tt>composed_of :balance, :class_name => 'Money'</tt> returns the Money class
+ # <tt>has_many :clients</tt> returns the Client class
def klass
@klass ||= class_name.constantize
end
# Returns the class name for the macro.
- # <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>'Money'</tt>
- # <tt>has_many :clients</tt> will return <tt>'Client'</tt>
+ #
+ # <tt>composed_of :balance, :class_name => 'Money'</tt> returns <tt>'Money'</tt>
+ # <tt>has_many :clients</tt> returns <tt>'Client'</tt>
def class_name
@class_name ||= options[:class_name] || derive_class_name
end
@@ -153,7 +157,7 @@ module ActiveRecord
# Holds all the meta-data about an association as it was specified in the
# Active Record class.
class AssociationReflection < MacroReflection #:nodoc:
- # Returns the target association's class:
+ # Returns the target association's class.
#
# class Author < ActiveRecord::Base
# has_many :books
@@ -162,7 +166,7 @@ module ActiveRecord
# Author.reflect_on_association(:books).klass
# # => Book
#
- # <b>Note:</b> do not call +klass.new+ or +klass.create+ to instantiate
+ # <b>Note:</b> Do not call +klass.new+ or +klass.create+ to instantiate
# a new association object. Use +build_association+ or +create_association+
# instead. This allows plugins to hook into association object creation.
def klass
@@ -273,7 +277,7 @@ module ActiveRecord
end
# Returns whether or not this association reflection is for a collection
- # association. Returns +true+ if the +macro+ is one of +has_many+ or
+ # association. Returns +true+ if the +macro+ is either +has_many+ or
# +has_and_belongs_to_many+, +false+ otherwise.
def collection?
@collection
@@ -283,7 +287,7 @@ module ActiveRecord
# the parent's validation.
#
# Unless you explicitly disable validation with
- # <tt>:validate => false</tt>, it will take place when:
+ # <tt>:validate => false</tt>, validation will take place when:
#
# * you explicitly enable validation; <tt>:validate => true</tt>
# * you use autosave; <tt>:autosave => true</tt>
@@ -327,8 +331,6 @@ module ActiveRecord
# Gets the source of the through reflection. It checks both a singularized
# and pluralized form for <tt>:belongs_to</tt> or <tt>:has_many</tt>.
#
- # (The <tt>:tags</tt> association on Tagging below.)
- #
# class Post < ActiveRecord::Base
# has_many :taggings
# has_many :tags, :through => :taggings
@@ -339,7 +341,7 @@ module ActiveRecord
end
# Returns the AssociationReflection object specified in the <tt>:through</tt> option
- # of a HasManyThrough or HasOneThrough association. Example:
+ # of a HasManyThrough or HasOneThrough association.
#
# class Post < ActiveRecord::Base
# has_many :taggings
diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile
index 983c04c3d9..fb625f7a44 100644
--- a/railties/guides/source/command_line.textile
+++ b/railties/guides/source/command_line.textile
@@ -23,18 +23,18 @@ There are a few commands that are absolutely critical to your everyday usage of
* <tt>rake</tt>
* <tt>rails generate</tt>
* <tt>rails dbconsole</tt>
-* <tt>rails app_name</tt>
+* <tt>rails new app_name</tt>
Let's create a simple Rails application to step through each of these commands in context.
-h4. +rails+
+h4. +rails new+
-The first thing we'll want to do is create a new Rails application by running the +rails+ command after installing Rails.
+The first thing we'll want to do is create a new Rails application by running the +rails new+ command after installing Rails.
WARNING: You know you need the rails gem installed by typing +gem install rails+ first, if you don't have this installed, follow the instructions in the "Rails 3 Release Notes":/3_0_release_notes.html
<shell>
-$ rails commandsapp
+$ rails new commandsapp
create
create README
create .gitignore
@@ -352,7 +352,7 @@ $ mkdir gitapp
$ cd gitapp
$ git init
Initialized empty Git repository in .git/
-$ rails . --git --database=postgresql
+$ rails new . --git --database=postgresql
exists
create app/controllers
create app/helpers
@@ -397,7 +397,7 @@ development:
...
</shell>
-It also generated some lines in our database.yml configuration corresponding to our choice of PostgreSQL for database. The only catch with using the SCM options is that you have to make your application's directory first, then initialize your SCM, then you can run the +rails+ command to generate the basis of your app.
+It also generated some lines in our database.yml configuration corresponding to our choice of PostgreSQL for database. The only catch with using the SCM options is that you have to make your application's directory first, then initialize your SCM, then you can run the +rails new+ command to generate the basis of your app.
h4. +server+ with Different Backends