diff options
author | Sergey Nartimov <just.lest@gmail.com> | 2013-02-11 17:00:55 +0300 |
---|---|---|
committer | Sergey Nartimov <just.lest@gmail.com> | 2013-02-11 17:00:55 +0300 |
commit | 9dfef5a46bb6a0c74a48aa70fa350c0f09f92c0d (patch) | |
tree | 6e8b5cb8a7e980a1a039632d609791b90aa5cbba /activerecord/CHANGELOG.md | |
parent | cdd293cb963b895ff580eb20d10f5d56ecb3d447 (diff) | |
download | rails-9dfef5a46bb6a0c74a48aa70fa350c0f09f92c0d.tar.gz rails-9dfef5a46bb6a0c74a48aa70fa350c0f09f92c0d.tar.bz2 rails-9dfef5a46bb6a0c74a48aa70fa350c0f09f92c0d.zip |
define Active Record Store accessors in a module
Allow store accessors to be overrided like other attribute methods,
e.g.:
class User < ActiveRecord::Base
store :settings, accessors: [ :color, :homepage ], coder: JSON
def color
super || 'red'
end
end
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 27ba1a8d95..db21d323f6 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,17 @@ ## Rails 4.0.0 (unreleased) ## +* Allow store accessors to be overrided like other attribute methods, e.g.: + + class User < ActiveRecord::Base + store :settings, accessors: [ :color, :homepage ], coder: JSON + + def color + super || 'red' + end + end + + *Sergey Nartimov* + * Quote numeric values being compared to non-numeric columns. Otherwise, in some database, the string column values will be coerced to a numeric allowing 0, 0.0 or false to match any string starting with a non-digit. |