diff --git a/lib/active_model/serializer.rb b/lib/active_model/serializer.rb index e7f74ced..5d6868c4 100644 --- a/lib/active_model/serializer.rb +++ b/lib/active_model/serializer.rb @@ -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'