Skip to content

Add jsonapi-rb support #113

Closed
Closed
@SrMouraSilva

Description

@SrMouraSilva

Hello, jsonapi-rb uses

render jsonapi: ...

Instead the configured json or xml

collection = options[:json] || options[:xml]
collection = _paginate_collection(collection, options)
options[:json] = collection if options[:json]
options[:xml] = collection if options[:xml]

My ideia is add a custom parameter that informs possible extensions

# In configuration file
config.render_options = [:json, :jsonapi, :xml]

# In lib/rails/pagination.rb
option = extension(options)

collection = options[option]
collection = _paginate_collection(collection, options)

options[option] = collection

def extension(options)
  for option in config.render_options
    return key if options.key?(key)
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions