update code examples to 1.9 hash syntax in the AR/README [ci skip]

This commit is contained in:
Francesco Rodriguez 2012-09-17 00:28:05 -05:00
parent d71d5ba71f
commit 82355dfb35
1 changed files with 12 additions and 12 deletions

View File

@ -49,10 +49,10 @@ A short rundown of some of the major features:
* Aggregations of value objects.
class Account < ActiveRecord::Base
composed_of :balance, :class_name => "Money",
:mapping => %w(balance amount)
composed_of :balance, class_name: 'Money',
mapping: %w(balance amount)
composed_of :address,
:mapping => [%w(address_street street), %w(address_city city)]
mapping: [%w(address_street street), %w(address_city city)]
end
{Learn more}[link:classes/ActiveRecord/Aggregations/ClassMethods.html]
@ -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).deliver
CommentMailer.new_comment_email('david@loudthinking.com', comment).deliver
end
end
@ -124,15 +124,15 @@ A short rundown of some of the major features:
* Database abstraction through simple adapters.
# connect to SQLite3
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "dbfile.sqlite3")
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'dbfile.sqlite3')
# connect to MySQL with authentication
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "me",
:password => "secret",
:database => "activerecord"
adapter: 'mysql2',
host: 'localhost',
username: 'me',
password: 'secret',
database: 'activerecord'
)
{Learn more}[link:classes/ActiveRecord/Base.html] and read about the built-in support for
@ -144,7 +144,7 @@ A short rundown of some of the major features:
* Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc].
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
ActiveRecord::Base.logger = Log4r::Logger.new("Application Log")
ActiveRecord::Base.logger = Log4r::Logger.new('Application Log')
* Database agnostic schema management with Migrations.
@ -159,7 +159,7 @@ A short rundown of some of the major features:
t.integer :position
end
SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1
SystemSetting.create name: 'notice', label: 'Use notice?', value: 1
end
def down