diff options
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/base.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/wrap.rb | 2 | ||||
-rw-r--r-- | guides/source/active_record_postgresql.md | 23 | ||||
-rw-r--r-- | guides/source/active_support_core_extensions.md | 4 |
5 files changed, 28 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 9390e2937a..3800c61dab 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -2,6 +2,7 @@ require 'stringio' require 'uri' require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/object/try' +require 'active_support/core_ext/string/strip' require 'rack/test' require 'minitest' diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c8f8f2c3d8..9c5b7d937d 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -120,7 +120,7 @@ module ActiveRecord #:nodoc: # All column values are automatically available through basic accessors on the Active Record # object, but sometimes you want to specialize this behavior. This can be done by overwriting # the default accessors (using the same name as the attribute) and calling - # super to actually change things. + # +super+ to actually change things. # # class Song < ActiveRecord::Base # # Uses an integer of seconds to hold the length of the song diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 152eb02218..10c5e2535d 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -3,7 +3,7 @@ class Array # # Specifically: # - # * If the argument is +nil+ an empty list is returned. + # * If the argument is +nil+ an empty array is returned. # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. # * Otherwise, returns an array with the argument as its single element. # diff --git a/guides/source/active_record_postgresql.md b/guides/source/active_record_postgresql.md index 4d9c1776f4..66a11e5785 100644 --- a/guides/source/active_record_postgresql.md +++ b/guides/source/active_record_postgresql.md @@ -245,6 +245,7 @@ article.save! * [type definition](http://www.postgresql.org/docs/9.3/static/datatype-uuid.html) * [generator functions](http://www.postgresql.org/docs/9.3/static/uuid-ossp.html) +NOTE: you need to enable the `uuid-ossp` extension to use uuid. ```ruby # db/migrate/20131220144913_create_revisions.rb @@ -263,6 +264,28 @@ revision = Revision.first revision.identifier # => "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11" ``` +You can use `uuid` type to define references in migrations + +```ruby +# db/migrate/20150418012400_create_blog.rb +create_table :posts, id: :uuid + +create_table :comments, id: :uuid do |t| + # t.belongs_to :post, type: :uuid + t.references :post, type: :uuid +end + +# app/models/post.rb +class Post < ActiveRecord::Base + has_many :comments +end + +# app/models/comment.rb +class Comment < ActiveRecord::Base + belongs_to :post +end +``` + ### Bit String Types * [type definition](http://www.postgresql.org/docs/9.3/static/datatype-bit.html) diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index ff60f95a2c..fe2ab27a5a 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2188,7 +2188,7 @@ The method `without` returns a copy of an enumerable with the specified elements removed: ```ruby -people.without("Aaron", "Todd") +["David", "Rafael", "Aaron", "Todd"].without("Aaron", "Todd") # => ["David", "Rafael"] ``` NOTE: Defined in `active_support/core_ext/enumerable.rb`. @@ -2428,7 +2428,7 @@ The method `Array.wrap` wraps its argument in an array unless it is already an a Specifically: -* If the argument is `nil` an empty list is returned. +* If the argument is `nil` an empty array is returned. * Otherwise, if the argument responds to `to_ary` it is invoked, and if the value of `to_ary` is not `nil`, it is returned. * Otherwise, an array with the argument as its single element is returned. |