diff --git a/README.rdoc b/README.rdoc
index ea98d78a27..8476db6663 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -48,12 +48,12 @@ more separate. Each of these packages can be used independently outside of
"Welcome aboard: You're riding Ruby on Rails!"
-5. Follow the guidelines to start developing your application. You can find
-the following resources handy:
+5. Follow the guidelines to start developing your application. You can find the following resources handy:
* The README file created within your application.
* The {Getting Started Guide}[http://guides.rubyonrails.org/getting_started.html].
* The {Ruby on Rails Tutorial Book}[http://railstutorial.org/book].
+* The {API documentation}[http://api.rubyonrails.org].
== Contributing
diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb
index 79ebf29c7f..85270d84d8 100644
--- a/actionpack/lib/abstract_controller/base.rb
+++ b/actionpack/lib/abstract_controller/base.rb
@@ -6,6 +6,10 @@ module AbstractController
class Error < StandardError; end
class ActionNotFound < StandardError; end
+ # AbstractController::Base is a low-level API. Nobody should be
+ # using it directly, and subclasses (like ActionController::Base) are
+ # expected to provide their own +render+ method, since rendering means
+ # different things depending on the context.
class Base
attr_internal :response_body
attr_internal :action_name
@@ -36,13 +40,12 @@ module AbstractController
controller.public_instance_methods(true)
end
- # The list of hidden actions to an empty Array. Defaults to an
- # empty Array. This can be modified by other modules or subclasses
+ # The list of hidden actions to an empty array. Defaults to an
+ # empty array. This can be modified by other modules or subclasses
# to specify particular actions as hidden.
#
# ==== Returns
- # Array[String]:: An array of method names that should not be
- # considered actions.
+ # * array - An array of method names that should not be considered actions.
def hidden_actions
[]
end
@@ -54,8 +57,7 @@ module AbstractController
# itself. Finally, #hidden_actions are removed.
#
# ==== Returns
- # Array[String]:: A list of all methods that should be considered
- # actions.
+ # * array - A list of all methods that should be considered actions.
def action_methods
@action_methods ||= begin
# All public instance methods of this class, including ancestors
@@ -84,7 +86,7 @@ module AbstractController
# controller_name.
#
# ==== Returns
- # String
+ # * string
def controller_path
@controller_path ||= name.sub(/Controller$/, '').underscore unless anonymous?
end
@@ -104,7 +106,7 @@ module AbstractController
# ActionNotFound error is raised.
#
# ==== Returns
- # self
+ # * self
def process(action, *args)
@_action_name = action_name = action.to_s
@@ -133,10 +135,10 @@ module AbstractController
# can be considered an action.
#
# ==== Parameters
- # name:: The name of an action to be tested
+ # * name - The name of an action to be tested
#
# ==== Returns
- # TrueClass, FalseClass
+ # * TrueClass, FalseClass
def action_method?(name)
self.class.action_methods.include?(name)
end
@@ -180,11 +182,11 @@ module AbstractController
# returns nil, an ActionNotFound exception will be raised.
#
# ==== Parameters
- # action_name:: An action name to find a method name for
+ # * action_name - An action name to find a method name for
#
# ==== Returns
- # String:: The name of the method that handles the action
- # nil:: No method name could be found. Raise ActionNotFound.
+ # * string - The name of the method that handles the action
+ # * nil - No method name could be found. Raise ActionNotFound.
def method_for_action(action_name)
if action_method?(action_name) then action_name
elsif respond_to?(:action_missing, true) then "_handle_action_missing"
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb
index 67efeb7063..7b0d80614d 100644
--- a/actionpack/lib/abstract_controller/callbacks.rb
+++ b/actionpack/lib/abstract_controller/callbacks.rb
@@ -28,9 +28,8 @@ module AbstractController
# a Rails process.
#
# ==== Options
- # :only<#to_s>:: The callback should be run only for this action
- # :except<#to_s>:: The callback should be run for all actions
- # except this action
+ # * only - The callback should be run only for this action
+ # * except - The callback should be run for all actions except this action
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
@@ -45,7 +44,7 @@ module AbstractController
# Skip before, after, and around filters matching any of the names
#
# ==== Parameters
- # *names, :except and :methods .
diff --git a/activemodel/lib/active_model/serializers/json.rb b/activemodel/lib/active_model/serializers/json.rb
index cf1c4a0fed..c9271ed9b4 100644
--- a/activemodel/lib/active_model/serializers/json.rb
+++ b/activemodel/lib/active_model/serializers/json.rb
@@ -19,16 +19,16 @@ module ActiveModel
# passed through +options+.
#
# The option include_root_in_json controls the top-level behavior
- # of +to_json+. If true (the default) +to_json+ will emit a single root
+ # of +as_json+. If true (the default) +as_json+ will emit a single root
# node named after the object's type. For example:
#
# konata = User.find(1)
- # konata.to_json
+ # konata.as_json
# # => { "user": {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true} }
#
# ActiveRecord::Base.include_root_in_json = false
- # konata.to_json
+ # konata.as_json
# # => {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true}
#
@@ -39,29 +39,29 @@ module ActiveModel
# attributes. For example:
#
# konata = User.find(1)
- # konata.to_json
+ # konata.as_json
# # => {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true}
#
# The :only and :except options can be used to limit the attributes
# included, and work similar to the +attributes+ method. For example:
#
- # konata.to_json(:only => [ :id, :name ])
+ # konata.as_json(:only => [ :id, :name ])
# # => {"id": 1, "name": "Konata Izumi"}
#
- # konata.to_json(:except => [ :id, :created_at, :age ])
+ # konata.as_json(:except => [ :id, :created_at, :age ])
# # => {"name": "Konata Izumi", "awesome": true}
#
# To include the result of some method calls on the model use :methods:
#
- # konata.to_json(:methods => :permalink)
+ # konata.as_json(:methods => :permalink)
# # => {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true,
# "permalink": "1-konata-izumi"}
#
# To include associations use :include:
#
- # konata.to_json(:include => :posts)
+ # konata.as_json(:include => :posts)
# # => {"id": 1, "name": "Konata Izumi", "age": 16,
# "created_at": "2006/08/01", "awesome": true,
# "posts": [{"id": 1, "author_id": 1, "title": "Welcome to the weblog"},
@@ -69,7 +69,7 @@ module ActiveModel
#
# Second level and higher order associations work as well:
#
- # konata.to_json(:include => { :posts => {
+ # konata.as_json(:include => { :posts => {
# :include => { :comments => {
# :only => :body } },
# :only => :title } })
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb
index 7cf73f7eb3..ab78067106 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -7,18 +7,17 @@ module ActiveRecord
#
# * Count all: By not passing any parameters to count, it will return a count of all the rows for the model.
# * Count using column: By passing a column name to count, it will return a count of all the
- # rows for the model with supplied column present
+ # rows for the model with supplied column present.
# * Count using options will find the row count matched by the options used.
#
# The third approach, count using options, accepts an option hash as the only parameter. The options are:
#
# * :conditions: An SQL fragment like "administrator = 1" or [ "user_name = ?", username ].
# See conditions in the intro to ActiveRecord::Base.
- # * :joins: Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id" (rarely needed)
- # or named associations in the same form used for the :include option, which will
- # perform an INNER JOIN on the associated table(s).
- # If the value is a string, then the records will be returned read-only since they will have
- # attributes that do not correspond to the table's columns.
+ # * :joins: Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id"
+ # (rarely needed) or named associations in the same form used for the :include option, which will
+ # perform an INNER JOIN on the associated table(s). If the value is a string, then the records
+ # will be returned read-only since they will have attributes that do not correspond to the table's columns.
# Pass :readonly => false to override.
# * :include: Named associations that should be loaded alongside using LEFT OUTER JOINs.
# The symbols named refer to already defined associations. When using named associations, count
@@ -27,8 +26,7 @@ module ActiveRecord
# * :order: An SQL fragment like "created_at DESC, name" (really only used with GROUP BY calculations).
# * :group: An attribute name by which the result should be grouped. Uses the GROUP BY SQL-clause.
# * :select: By default, this is * as in SELECT * FROM, but can be changed if you, for example,
- # want to do a join but not
- # include the joined columns.
+ # want to do a join but not include the joined columns.
# * :distinct: Set this to true to make this a distinct calculation, such as
# SELECT COUNT(DISTINCT posts.id) ...
# * :from - By default, this is the table name of the class, but can be changed to an
diff --git a/railties/guides/rails_guides/indexer.rb b/railties/guides/rails_guides/indexer.rb
index bd817786ed..fb46491817 100644
--- a/railties/guides/rails_guides/indexer.rb
+++ b/railties/guides/rails_guides/indexer.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/object/blank'
require 'active_support/ordered_hash'
+require 'active_support/core_ext/string/inflections'
module RailsGuides
class Indexer
@@ -58,7 +59,7 @@ module RailsGuides
end
def title_to_idx(title)
- idx = title.strip.downcase.gsub(/\s+|_/, '-').delete('^a-z0-9-').sub(/^[^a-z]*/, '')
+ idx = title.strip.parameterize.sub(/^\d+/, '')
if warnings && idx.blank?
puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)"
end
diff --git a/railties/guides/source/3_0_release_notes.textile b/railties/guides/source/3_0_release_notes.textile
index 14da650e83..464fd66b7b 100644
--- a/railties/guides/source/3_0_release_notes.textile
+++ b/railties/guides/source/3_0_release_notes.textile
@@ -201,9 +201,9 @@ Finally a couple of enhancements were added to the rake tasks:
Railties now deprecates:
-* RAILS_ROOT in favour of Rails.root,
-* RAILS_ENV in favour of Rails.env, and
-* RAILS_DEFAULT_LOGGER in favour of Rails.logger.
+* RAILS_ROOT in favor of Rails.root,
+* RAILS_ENV in favor of Rails.env, and
+* RAILS_DEFAULT_LOGGER in favor of Rails.logger.
PLUGIN/rails/tasks, and PLUGIN/tasks are no longer loaded all tasks now must be in PLUGIN/lib/tasks.
@@ -241,7 +241,7 @@ h4. Action Controller
Deprecations:
-* filter_parameter_logging is deprecated in favour of config.filter_parameters << :password.
+* filter_parameter_logging is deprecated in favor of config.filter_parameters << :password.
More Information:
* "Render Options in Rails 3":http://www.engineyard.com/blog/2010/render-options-in-rails-3/
@@ -363,8 +363,8 @@ Validations have been moved from Active Record into Active Model, providing an i
* The +validates+ method has the following options:
* :acceptance => Boolean.
* :confirmation => Boolean.
- * :exclusion => { :in => Ennumerable }.
- * :inclusion => { :in => Ennumerable }.
+ * :exclusion => { :in => Enumerable }.
+ * :inclusion => { :in => Enumerable }.
* :format => { :with => Regexp, :on => :create }.
* :length => { :maximum => Fixnum }.
* :numericality => Boolean.
@@ -452,7 +452,7 @@ h4. Patches and Deprecations
Additionally, many fixes in the Active Record branch:
-* SQLite 2 support has been dropped in favour of SQLite 3.
+* SQLite 2 support has been dropped in favor of SQLite 3.
* MySQL support for column order.
* PostgreSQL adapter has had its +TIME ZONE+ support fixed so it no longer inserts incorrect values.
* Support multiple schemas in table names for PostgreSQL.
@@ -464,11 +464,11 @@ As well as the following deprecations:
* +named_scope+ in an Active Record class is deprecated and has been renamed to just +scope+.
* In +scope+ methods, you should move to using the relation methods, instead of a :conditions => {} finder method, for example scope :since, lambda {|time| where("created_at > ?", time) }.
-* save(false) is deprecated, in favour of save(:validate => false).
+* save(false) is deprecated, in favor of save(:validate => false).
* I18n error messages for ActiveRecord should be changed from :en.activerecord.errors.template to :en.errors.template.
-* model.errors.on is deprecated in favour of model.errors[]
+* model.errors.on is deprecated in favor of model.errors[]
* validates_presence_of => validates... :presence => true
-* ActiveRecord::Base.colorize_logging and config.active_record.colorize_logging are deprecated in favour of Rails::LogSubscriber.colorize_logging or config.colorize_logging
+* ActiveRecord::Base.colorize_logging and config.active_record.colorize_logging are deprecated in favor of Rails::LogSubscriber.colorize_logging or config.colorize_logging
NOTE: While an implementation of State Machine has been in Active Record edge for some months now, it has been removed from the Rails 3.0 release.
@@ -491,7 +491,7 @@ Active Resource was also extracted out to Active Model allowing you to use Activ
* Renamed SchemaDefinition to Schema and define_schema to schema.
* Use the format of Active Resources rather than the content-type of remote errors to load errors.
* Use instance_eval for schema block.
-* Fix ActiveResource::ConnectionError#to_s when +@response+ does not respond to #code or #message, handles Ruby 1.9 compat.
+* Fix ActiveResource::ConnectionError#to_s when +@response+ does not respond to #code or #message, handles Ruby 1.9 compatibility.
* Add support for errors in JSON format.
* Ensure load works with numeric arrays.
* Recognizes a 410 response from remote resource as the resource has been deleted.
@@ -500,7 +500,7 @@ Active Resource was also extracted out to Active Model allowing you to use Activ
Deprecations:
-* save(false) is deprecated, in favour of save(:validate => false).
+* save(false) is deprecated, in favor of save(:validate => false).
* Ruby 1.9.2: URI.parse and .decode are deprecated and are no longer used in the library.
@@ -551,7 +551,7 @@ The following methods have been removed because they are now available in Ruby 1
* Object#instance_variable_defined?
* Enumerable#none?
-The security patch for REXML remains in Active Support because early patchlevels of Ruby 1.8.7 still need it. Active Support knows whether it has to apply it or not.
+The security patch for REXML remains in Active Support because early patch-levels of Ruby 1.8.7 still need it. Active Support knows whether it has to apply it or not.
The following methods have been removed because they are no longer used in the framework:
@@ -579,7 +579,7 @@ Action Mailer has been given a new API with TMail being replaced out with the ne
Deprecations:
-* :charset, :content_type, :mime_version, :implicit_parts_order are all deprecated in favour of ActionMailer.default :key => value style declarations.
+* :charset, :content_type, :mime_version, :implicit_parts_order are all deprecated in favor of ActionMailer.default :key => value style declarations.
* Mailer dynamic create_method_name and deliver_method_name are deprecated, just call method_name which now returns a Mail::Message object.
* ActionMailer.deliver(message) is deprecated, just call message.deliver.
* template_root is deprecated, pass options to a render call inside a proc from the format.mime_type method inside the mail generation block
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile
index e242cdaf73..cd3c0a1b7b 100644
--- a/railties/guides/source/action_view_overview.textile
+++ b/railties/guides/source/action_view_overview.textile
@@ -1380,7 +1380,7 @@ page.insert_html :bottom, 'my_list', '
Last item
'
h5. literal
-Returns an object whose to_json evaluates to the code provided. Use this to pass a literal JavaScript expression as an argument to another JavaScriptGenerator method.
+Returns an object whose as_json evaluates to the code provided. Use this to pass a literal JavaScript expression as an argument to another JavaScriptGenerator method.
h5. redirect_to
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile
index c292daa915..4823876f19 100644
--- a/railties/guides/source/getting_started.textile
+++ b/railties/guides/source/getting_started.textile
@@ -235,7 +235,7 @@ If you choose to use MySQL instead of the shipped Sqlite3 database, your +config
development:
- adapter: mysql
+ adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
@@ -1017,7 +1017,7 @@ Once we have made the new comment, we send the user back to the original post us
Now you can add posts and comments to your blog and have them show up in the right places.
-h3. Refactorization
+h3. Refactoring
Now that we have Posts and Comments working, if we take a look at the +app/views/posts/show.html.erb+ template, it's getting long and awkward. We can use partials to clean this up.
@@ -1141,7 +1141,7 @@ Then you make the +app/views/posts/show.html.erb+ look like the following:
<%= link_to 'Back to Posts', posts_path %> |
-The second render just defines the partial template we want to render, comments/form, Rails is smart enough to spot the forward slash in that string and realise that you want to render the _form.html.erb file in the app/views/comments directory.
+The second render just defines the partial template we want to render, comments/form, Rails is smart enough to spot the forward slash in that string and realize that you want to render the _form.html.erb file in the app/views/comments directory.
The +@post+ object is available to any partials rendered in the view because we defined it as an instance variable.
@@ -1279,7 +1279,7 @@ Again, run the migration to create the database table:
$ rake db:migrate
-Next, edit the +post.rb+ file to create the other side of the association, and to tell Rails (via the +accepts_nested_attributes+ macro) that you intend to edit tags via posts:
+Next, edit the +post.rb+ file to create the other side of the association, and to tell Rails (via the +accepts_nested_attributes_for+ macro) that you intend to edit tags via posts:
class Post < ActiveRecord::Base
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile
index fe5b4c8773..1bef4d2145 100644
--- a/railties/guides/source/layouts_and_rendering.textile
+++ b/railties/guides/source/layouts_and_rendering.textile
@@ -285,7 +285,7 @@ JSON is a javascript data format used by many AJAX libraries. Rails has built-in
render :json => @product
-TIP: You don't need to call +to_json+ on the object that you want to render. If you use the +:json+ option, +render+ will automatically call +to_json+ for you.
+TIP: You don't need to call +as_json+ on the object that you want to render. If you use the +:json+ option, +render+ will automatically call +as_json+ for you.
h5. Rendering XML