mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
New take on configuration
This commit is contained in:
parent
cf91146471
commit
0ba4830dee
@@ -4,7 +4,7 @@ require 'active_model/serializer'
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
class Association
|
||||
def initialize(name, options={})
|
||||
def initialize(name, options = {})
|
||||
if options.has_key?(:include)
|
||||
ActiveSupport::Deprecation.warn <<-WARN
|
||||
** Notice: include was renamed to embed_in_root. **
|
||||
@@ -13,8 +13,8 @@ module ActiveModel
|
||||
|
||||
@name = name.to_s
|
||||
@options = options
|
||||
self.embed = options.fetch(:embed) { CONFIG.embed }
|
||||
@embed_in_root = options.fetch(:embed_in_root) { options.fetch(:include) { CONFIG.embed_in_root } }
|
||||
self.embed = options.fetch(:embed) { Configuration.global.embed }
|
||||
@embed_in_root = options.fetch(:embed_in_root) { options.fetch(:include) { Configuration.global.embed_in_root } }
|
||||
@embed_key = options[:embed_key] || :id
|
||||
@key = options[:key]
|
||||
@embedded_key = options[:root] || name
|
||||
|
||||
Reference in New Issue
Block a user