Add docs and changelog entry for 73aab03 [ci skip]

This commit is contained in:
Sean Griffin 2015-05-30 11:06:16 -06:00
parent 50914b918e
commit 6bd2573869
2 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,11 @@
*Ryuta Kamizono*
* Allow proc defaults to be passed to the attributes API. See documentation
for examples.
*Sean Griffin, Kir Shatrov*
* SQLite: `:collation` support for string and text columns.
Example:

View File

@ -82,6 +82,14 @@ module ActiveRecord
#
# StoreListing.new.my_string # => "new default"
#
# class Product < ActiveRecord::Base
# attribute :my_default_proc, :datetime, default: -> { Time.now }
# end
#
# Product.new.my_default_proc # => 2015-05-30 11:04:48 -0600
# sleep 1
# Product.new.my_default_proc # => 2015-05-30 11:04:49 -0600
#
# Attributes do not need to be backed by a database column.
#
# class MyModel < ActiveRecord::Base
@ -204,7 +212,8 @@ module ActiveRecord
#
# +default+ The default value to use when no value is provided. If this option
# is not passed, the previous default value (if any) will be used.
# Otherwise, the default will be +nil+.
# Otherwise, the default will be +nil+. A proc can also be passed, and
# will be called once each time a new value is needed.
#
# +user_provided_default+ Whether the default value should be cast using
# +cast+ or +deserialize+.