aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/README.rdoc2
-rw-r--r--activerecord/README.rdoc2
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb30
-rw-r--r--activerecord/lib/active_record/locking/pessimistic.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/object/duplicable.rb2
-rw-r--r--railties/guides/source/layout.html.erb2
-rw-r--r--railties/guides/source/migrations.textile2
7 files changed, 23 insertions, 21 deletions
diff --git a/actionpack/README.rdoc b/actionpack/README.rdoc
index 5db4cff66b..2f3678881d 100644
--- a/actionpack/README.rdoc
+++ b/actionpack/README.rdoc
@@ -33,7 +33,7 @@ A short rundown of some of the major features:
* Actions grouped in controller as methods instead of separate command objects
and can therefore share helper methods
- CustomersController < ActionController::Base
+ class CustomersController < ActionController::Base
def show
@customer = find_customer
end
diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc
index 3a89446a83..6b4c85bb93 100644
--- a/activerecord/README.rdoc
+++ b/activerecord/README.rdoc
@@ -84,7 +84,7 @@ A short rundown of some of the major features:
class CommentObserver < ActiveRecord::Observer
def after_create(comment) # is called just after Comment#save
- CommentMailer.new_comment_email("david@loudthinking.com", comment)
+ CommentMailer.new_comment_email("david@loudthinking.com", comment).deliver
end
end
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index cdedcde0eb..3afa257a76 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -3,16 +3,17 @@ module ActiveRecord
# == What is Optimistic Locking
#
# Optimistic locking allows multiple users to access the same record for edits, and assumes a minimum of
- # conflicts with the data. It does this by checking whether another process has made changes to a record since
- # it was opened, an ActiveRecord::StaleObjectError is thrown if that has occurred and the update is ignored.
+ # conflicts with the data. It does this by checking whether another process has made changes to a record since
+ # it was opened, an <tt>ActiveRecord::StaleObjectError</tt> exception is thrown if that has occurred
+ # and the update is ignored.
#
- # Check out ActiveRecord::Locking::Pessimistic for an alternative.
+ # Check out <tt>ActiveRecord::Locking::Pessimistic</tt> for an alternative.
#
# == Usage
#
- # Active Records support optimistic locking if the field <tt>lock_version</tt> is present. Each update to the
- # record increments the lock_version column and the locking facilities ensure that records instantiated twice
- # will let the last one saved raise a StaleObjectError if the first was also updated. Example:
+ # Active Records support optimistic locking if the field +lock_version+ is present. Each update to the
+ # record increments the +lock_version+ column and the locking facilities ensure that records instantiated twice
+ # will let the last one saved raise a +StaleObjectError+ if the first was also updated. Example:
#
# p1 = Person.find(1)
# p2 = Person.find(1)
@@ -36,10 +37,10 @@ module ActiveRecord
# You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging,
# or otherwise apply the business logic needed to resolve the conflict.
#
- # You must ensure that your database schema defaults the lock_version column to 0.
+ # You must ensure that your database schema defaults the +lock_version+ column to 0.
#
# This behavior can be turned off by setting <tt>ActiveRecord::Base.lock_optimistically = false</tt>.
- # To override the name of the lock_version column, invoke the <tt>set_locking_column</tt> method.
+ # To override the name of the +lock_version+ column, invoke the <tt>set_locking_column</tt> method.
# This method uses the same syntax as <tt>set_table_name</tt>
module Optimistic
extend ActiveSupport::Concern
@@ -68,9 +69,9 @@ module ActiveRecord
result = super
# If the locking column has no default value set,
- # start the lock version at zero. Note we can't use
- # locking_enabled? at this point as @attributes may
- # not have been initialized yet
+ # start the lock version at zero. Note we can't use
+ # <tt>locking_enabled?</tt> at this point as
+ # <tt>@attributes</tt> may not have been initialized yet.
if lock_optimistically && result.include?(self.class.locking_column)
result[self.class.locking_column] ||= 0
@@ -137,10 +138,9 @@ module ActiveRecord
module ClassMethods
DEFAULT_LOCKING_COLUMN = 'lock_version'
- # Is optimistic locking enabled for this table? Returns true if the
- # +lock_optimistically+ flag is set to true (which it is, by default)
- # and the table includes the +locking_column+ column (defaults to
- # +lock_version+).
+ # Returns true if the +lock_optimistically+ flag is set to true
+ # (which it is, by default) and the table includes the
+ # +locking_column+ column (defaults to +lock_version+).
def locking_enabled?
lock_optimistically && columns_hash[locking_column]
end
diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb
index 862cf8f72a..4c4c1bf5a1 100644
--- a/activerecord/lib/active_record/locking/pessimistic.rb
+++ b/activerecord/lib/active_record/locking/pessimistic.rb
@@ -3,7 +3,7 @@ module ActiveRecord
# Locking::Pessimistic provides support for row-level locking using
# SELECT ... FOR UPDATE and other lock types.
#
- # Pass <tt>:lock => true</tt> to ActiveRecord::Base.find to obtain an exclusive
+ # Pass <tt>:lock => true</tt> to <tt>ActiveRecord::Base.find</tt> to obtain an exclusive
# lock on the selected rows:
# # select * from accounts where id=1 for update
# Account.find(1, :lock => true)
@@ -21,7 +21,7 @@ module ActiveRecord
# yuko.save!
# end
#
- # You can also use ActiveRecord::Base#lock! method to lock one record by id.
+ # You can also use <tt>ActiveRecord::Base#lock!</tt> method to lock one record by id.
# This may be better if you don't need to lock every row. Example:
#
# Account.transaction do
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
index 02cb5dfee7..9d044eba71 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -1,3 +1,4 @@
+#--
# Most objects are cloneable, but not all. For example you can't dup +nil+:
#
# nil.dup # => TypeError: can't dup NilClass
@@ -14,6 +15,7 @@
#
# That's why we hardcode the following cases and check duplicable? instead of
# using that rescue idiom.
+#++
class Object
# Can you safely dup this object?
#
diff --git a/railties/guides/source/layout.html.erb b/railties/guides/source/layout.html.erb
index 911655e0f4..5dcac8e74c 100644
--- a/railties/guides/source/layout.html.erb
+++ b/railties/guides/source/layout.html.erb
@@ -27,7 +27,7 @@
<a href="http://rubyonrails.org/">Overview</a> |
<a href="http://rubyonrails.org/download">Download</a> |
<a href="http://rubyonrails.org/deploy">Deploy</a> |
- <a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview">Code</a> |
+ <a href="https://github.com/rails/rails">Code</a> |
<a href="http://rubyonrails.org/screencasts">Screencasts</a> |
<a href="http://rubyonrails.org/documentation">Documentation</a> |
<a href="http://rubyonrails.org/ecosystem">Ecosystem</a> |
diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile
index 27f8a9303e..d60b68ec7f 100644
--- a/railties/guides/source/migrations.textile
+++ b/railties/guides/source/migrations.textile
@@ -386,7 +386,7 @@ class ExampleMigration < ActiveRecord::Migration
end
</ruby>
-Sometimes your migration will do something which is just plain irreversible, for example it might destroy some data. In cases like those when you can't reverse the migration you can raise +IrreversibleMigration+ from your +down+ method. If someone tries to revert your migration an error message will be displayed saying that it can't be done.
+Sometimes your migration will do something which is just plain irreversible, for example it might destroy some data. In cases like those when you can't reverse the migration you can raise +ActiveRecord::IrreversibleMigration+ from your +down+ method. If someone tries to revert your migration an error message will be displayed saying that it can't be done.
h3. Running Migrations