mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
Define root and root= as aliases of _root=
This commit is contained in:
parent
7ba05c02e3
commit
3fcd8c5f98
@ -7,11 +7,8 @@ module ActiveModel
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
attr_accessor :_root
|
attr_accessor :_root
|
||||||
|
alias root _root=
|
||||||
def root(root)
|
alias root= _root=
|
||||||
@_root = root
|
|
||||||
end
|
|
||||||
alias root= root
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(object, options={})
|
def initialize(object, options={})
|
||||||
|
|||||||
@ -21,11 +21,8 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :_root, :_attributes, :_associations
|
attr_accessor :_root, :_attributes, :_associations
|
||||||
|
alias root _root=
|
||||||
def root(root)
|
alias root= _root=
|
||||||
@_root = root
|
|
||||||
end
|
|
||||||
alias root= root
|
|
||||||
|
|
||||||
def root_name
|
def root_name
|
||||||
name.demodulize.underscore.sub(/_serializer$/, '') if name
|
name.demodulize.underscore.sub(/_serializer$/, '') if name
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user