Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 82355dfb35c8bc2eeb29ccfa48b5a85e5e4ba687 1 parent d71d5ba
Francesco Rodríguez authored September 17, 2012

Showing 1 changed file with 12 additions and 12 deletions. Show diff stats Hide diff stats

  1. 24  activerecord/README.rdoc
24  activerecord/README.rdoc
Source Rendered
@@ -49,10 +49,10 @@ A short rundown of some of the major features:
49 49
 * Aggregations of value objects.
50 50
 
51 51
    class Account < ActiveRecord::Base
52  
-     composed_of :balance, :class_name => "Money",
53  
-                 :mapping => %w(balance amount)
  52
+     composed_of :balance, class_name: 'Money',
  53
+                 mapping: %w(balance amount)
54 54
      composed_of :address,
55  
-                 :mapping => [%w(address_street street), %w(address_city city)]
  55
+                 mapping: [%w(address_street street), %w(address_city city)]
56 56
    end
57 57
 
58 58
   {Learn more}[link:classes/ActiveRecord/Aggregations/ClassMethods.html]
@@ -84,7 +84,7 @@ A short rundown of some of the major features:
84 84
 
85 85
    class CommentObserver < ActiveRecord::Observer
86 86
      def after_create(comment) # is called just after Comment#save
87  
-       CommentMailer.new_comment_email("david@loudthinking.com", comment).deliver
  87
+       CommentMailer.new_comment_email('david@loudthinking.com', comment).deliver
88 88
      end
89 89
    end
90 90
 
@@ -124,15 +124,15 @@ A short rundown of some of the major features:
124 124
 * Database abstraction through simple adapters.
125 125
 
126 126
     # connect to SQLite3
127  
-    ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "dbfile.sqlite3")
  127
+    ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'dbfile.sqlite3')
128 128
 
129 129
     # connect to MySQL with authentication
130 130
     ActiveRecord::Base.establish_connection(
131  
-      :adapter  => "mysql2",
132  
-      :host     => "localhost",
133  
-      :username => "me",
134  
-      :password => "secret",
135  
-      :database => "activerecord"
  131
+      adapter:  'mysql2',
  132
+      host:     'localhost',
  133
+      username: 'me',
  134
+      password: 'secret',
  135
+      database: 'activerecord'
136 136
     )
137 137
 
138 138
   {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:
144 144
 * Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc].
145 145
 
146 146
     ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
147  
-    ActiveRecord::Base.logger = Log4r::Logger.new("Application Log")
  147
+    ActiveRecord::Base.logger = Log4r::Logger.new('Application Log')
148 148
 
149 149
 
150 150
 * Database agnostic schema management with Migrations.
@@ -159,7 +159,7 @@ A short rundown of some of the major features:
159 159
           t.integer :position
160 160
         end
161 161
 
162  
-        SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1
  162
+        SystemSetting.create name: 'notice', label: 'Use notice?', value: 1
163 163
       end
164 164
 
165 165
       def down

0 notes on commit 82355df

Please sign in to comment.
Something went wrong with that request. Please try again.