New take on configuration

This commit is contained in:
Adrian Mugnolo and Santiago Pastorino
2014-01-10 19:25:43 -02:00
parent cf91146471
commit 0ba4830dee
6 changed files with 137 additions and 134 deletions

View File

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