Skip to content

Commit

Permalink
Harmonized hash notation in AR::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny committed May 5, 2008
1 parent 67ebf14 commit e9afd67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions activerecord/lib/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -601,15 +601,15 @@ def exists?(id_or_conditions)
# 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|
# 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)
Expand All @@ -634,10 +634,10 @@ def create(attributes = nil, &block)
# ==== Examples
#
# # Updating one record:
# Person.update(15, {:user_name => 'Samuel', :group => 'expert'})
# Person.update(15, { :user_name => 'Samuel', :group => 'expert' })
#
# # Updating multiple records:
# people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
# people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy" } }
# Person.update(people.keys, people.values)
def update(id, attributes)
if id.is_a?(Array)
Expand Down Expand Up @@ -1768,7 +1768,7 @@ def define_attr_method(name, value=nil, &block)
# class Article < ActiveRecord::Base
# def self.find_with_scope
# with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }, :create => { :blog_id => 1 }) do
# with_scope(:find => { :limit => 10})
# with_scope(:find => { :limit => 10 })
# find(:all) # => SELECT * from articles WHERE blog_id = 1 LIMIT 10
# end
# with_scope(:find => { :conditions => "author_id = 3" })
Expand Down

0 comments on commit e9afd67

Please sign in to comment.