| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The native JSON library bypasses the `to_json` overrides in
active_support/core_ext/object/to_json.rb by calling its native
implementation directly. However `ActiveRecord::Store` uses a
HWIA so `JSON.dump` will call our `to_json` instead with a
`State` object for options rather than a `Hash`. This generates
a warning when the `:encoding`, `:only` & `:except` keys are
accessed in `Hash#as_json` because the `State` object delegates
unknown keys to `instance_variable_get` in its `:[]` method.
Workaround this warning in the test by using a custom coder that
calls `ActiveSupport::JSON.encode` directly.
|
| |
|
| |
|
|
|
|
| |
store_accessor
|
|
|
|
| |
used out of the box.
|
| |
|
| |
|
|
|
|
| |
stores [DHH]
|
|
Signed-off-by: José Valim <jose.valim@gmail.com>
|