Add deprecation message to .embed method

This commit is contained in:
Arthur Neves 2013-10-21 13:08:07 -04:00
parent 41f1855056
commit 84801301b9

View File

@ -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'