mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16: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={})
|
||||
SETTINGS[:embed] = type
|
||||
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
|
||||
|
||||
if RUBY_VERSION >= '2.0'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user