mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
Add deprecation message to .embed method
This commit is contained in:
parent
41f1855056
commit
84801301b9
@ -20,6 +20,15 @@ module ActiveModel
|
|||||||
def embed(type, options={})
|
def embed(type, options={})
|
||||||
SETTINGS[:embed] = type
|
SETTINGS[:embed] = type
|
||||||
SETTINGS[:include] = true if options[:include]
|
SETTINGS[:include] = true if options[:include]
|
||||||
|
warn <<-WARN
|
||||||
|
** Notice: embed is deprecated. **
|
||||||
|
The use of .embed method on a Serializer will be soon removed, as this should have a global scope and not a class scope.
|
||||||
|
Please use the global .setup method instead:
|
||||||
|
ActiveModel::Serializer.setup do |config|
|
||||||
|
config.embed = :#{type}
|
||||||
|
config.include = #{SETTINGS[:include] || false}
|
||||||
|
end
|
||||||
|
WARN
|
||||||
end
|
end
|
||||||
|
|
||||||
if RUBY_VERSION >= '2.0'
|
if RUBY_VERSION >= '2.0'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user