addresses_controller.rb 531 Bytes
Newer Older
hellekin's avatar
hellekin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# frozen_string_literal: true

class Api::V0::AddressesController < ApplicationController
  def index
    @addresses = policy_scope(Address)
    render jsonapi: @addresses,
           fields: params[:fields],
           include: include_from_params
  end

  def show
    @address = policy_scope(Address).find(params[:id])
    authorize @address
    render jsonapi: @address,
           fields: params[:fields],
           include: include_from_params
  end

  private

  def model_types
    %w(resource_addresses).freeze
  end
end