diff options
author | Larry Lv <larrylv1990@gmail.com> | 2012-09-15 03:25:21 +0800 |
---|---|---|
committer | Larry Lv <larrylv1990@gmail.com> | 2012-09-17 09:14:21 +0800 |
commit | 1efe30ebcef2e6d3967742f9bcf4f6675a946d14 (patch) | |
tree | 3f667a6d1535e0dfee5009b9b368a0a5c3ea0e1c /activesupport/CHANGELOG.md | |
parent | 82efe8943bf6ff12b597987506bf177d66609049 (diff) | |
download | rails-1efe30ebcef2e6d3967742f9bcf4f6675a946d14.tar.gz rails-1efe30ebcef2e6d3967742f9bcf4f6675a946d14.tar.bz2 rails-1efe30ebcef2e6d3967742f9bcf4f6675a946d14.zip |
set up config_accessor with a default value by block
* ActiveSupport::Configurable should allow config_accessor to take
default value by block, just like cattr_accessor.
class User
include ActiveSupport::Configurable
config_accessor :hair_colors do
[:brown, :black, :blonde, :red]
end
end
User.hair_colors # => [:brown, :black, :blonde, :red]
* remove trailing whitespaces in configurable.rb and its test file.
* Update ActiveSupport CHANGELOG.
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index c10a0b390b..59e112e3f9 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,18 @@ ## Rails 4.0.0 (unreleased) ## +* An optional block can be passed to `config_accessor` to set its default value + + class User + include ActiveSupport::Configurable + config_accessor :hair_colors do + [:brown, :black, :blonde, :red] + end + end + + User.hair_colors # => [:brown, :black, :blonde, :red] + + *Larry Lv* + * ActiveSupport::Benchmarkable#silence has been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1. *Steve Klabnik* |