Method: ActiveModel::Serializer::Adapter::JsonApi#initialize
- Defined in:
- lib/active_model/serializer/adapter/json_api.rb
#initialize(serializer, options = {}) ⇒ JsonApi
Returns a new instance of JsonApi.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/active_model/serializer/adapter/json_api.rb', line 6 def initialize(serializer, = {}) super @hash = { data: [] } @included = ActiveModel::Serializer::Utils.include_args_to_hash(@options[:include]) fields = .delete(:fields) if fields @fieldset = ActiveModel::Serializer::Fieldset.new(fields, serializer.json_key) else @fieldset = [:fieldset] end end |