diff options
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index c336e1f5bb..8e749772a1 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -15,18 +15,18 @@ module ActiveRecord # # ==== Examples # # Create a single new object - # User.create(:first_name => 'Jamie') + # User.create(first_name: 'Jamie') # # # Create an Array of new objects - # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) + # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) # # # Create a single object and pass it into a block to set other attributes. - # User.create(:first_name => 'Jamie') do |u| + # User.create(first_name: 'Jamie') do |u| # u.is_admin = false # end # # # Creating an Array of new objects using a block, where the block is executed for each object: - # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) do |u| + # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) do |u| # u.is_admin = false # end def create(attributes = nil, &block) @@ -64,7 +64,7 @@ module ActiveRecord # # By default, save always run validations. If any of them fail the action # is cancelled and +save+ returns +false+. However, if you supply - # :validate => false, validations are bypassed altogether. See + # validate: false, validations are bypassed altogether. See # ActiveRecord::Validations for more information. # # There's a series of callbacks associated with +save+. If any of the @@ -143,7 +143,7 @@ module ActiveRecord # inheritance structures where you want a subclass to appear as the # superclass. This can be used along with record identification in # Action Pack to allow, say, <tt>Client < Company</tt> to do something - # like render <tt>:partial => @client.becomes(Company)</tt> to render that + # like render <tt>partial: @client.becomes(Company)</tt> to render that # instance using the companies/company partial instead of clients/client. # # Note: The new instance will share a link to the same attributes as the original class. @@ -286,7 +286,7 @@ module ActiveRecord # Reloads the attributes of this object from the database. # The optional options argument is passed to find when reloading so you - # may do e.g. record.reload(:lock => true) to reload the same record with + # may do e.g. record.reload(lock: true) to reload the same record with # an exclusive row lock. def reload(options = nil) clear_aggregation_cache @@ -317,11 +317,11 @@ module ActiveRecord # If used along with +belongs_to+ then +touch+ will invoke +touch+ method on associated object. # # class Brake < ActiveRecord::Base - # belongs_to :car, :touch => true + # belongs_to :car, touch: true # end # # class Car < ActiveRecord::Base - # belongs_to :corporation, :touch => true + # belongs_to :corporation, touch: true # end # # # triggers @brake.car.touch and @brake.car.corporation.touch |