mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #836 from rails-api/stores-passed-in-options
Makes passed in options accessible inside serializers
This commit is contained in:
@@ -140,6 +140,7 @@ module ActiveModel
|
||||
|
||||
def initialize(object, options = {})
|
||||
@object = object
|
||||
@options = options
|
||||
@root = options[:root] || (self.class._root ? self.class.root_name : false)
|
||||
@meta = options[:meta]
|
||||
@meta_key = options[:meta_key]
|
||||
@@ -201,6 +202,8 @@ module ActiveModel
|
||||
|
||||
private
|
||||
|
||||
attr_reader :options
|
||||
|
||||
def self.get_serializer_for(klass)
|
||||
serializer_class_name = "#{klass.name}Serializer"
|
||||
serializer_class = serializer_class_name.safe_constantize
|
||||
|
||||
Reference in New Issue
Block a user