Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Harmonized hash notation in AR::Base

  • Loading branch information...
commit e9afd6790a8f530528f6597a7f59bb283be754f6 1 parent 67ebf14
@sunny sunny authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 activerecord/lib/active_record/base.rb
View
10 activerecord/lib/active_record/base.rb
@@ -601,7 +601,7 @@ 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|
@@ -609,7 +609,7 @@ def exists?(id_or_conditions)
# 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)
@@ -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)
@@ -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" })
Please sign in to comment.
Something went wrong with that request. Please try again.