mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16: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
|
||||
attr_accessor :_root
|
||||
|
||||
def root(root)
|
||||
@_root = root
|
||||
end
|
||||
alias root= root
|
||||
alias root _root=
|
||||
alias root= _root=
|
||||
end
|
||||
|
||||
def initialize(object, options={})
|
||||
|
||||
@ -21,11 +21,8 @@ module ActiveModel
|
||||
end
|
||||
|
||||
attr_accessor :_root, :_attributes, :_associations
|
||||
|
||||
def root(root)
|
||||
@_root = root
|
||||
end
|
||||
alias root= root
|
||||
alias root _root=
|
||||
alias root= _root=
|
||||
|
||||
def root_name
|
||||
name.demodulize.underscore.sub(/_serializer$/, '') if name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user