Files
openfoodnetwork/app/serializers/api/address_serializer.rb
Matt-Yorkley 1d5077061e Remove andand
This old gem implemented some functionality for handling nils which is no longer needed, as it's provided natively by Ruby with the &. operator.
2021-09-08 14:28:31 +01:00

19 lines
419 B
Ruby

# frozen_string_literal: true
class Api::AddressSerializer < ActiveModel::Serializer
# cached
# delegate :cache_key, to: :object
attributes :id, :zipcode, :city, :state_name, :state_id,
:phone, :firstname, :lastname, :address1, :address2, :city, :country_id,
:zipcode, :country_name
def country_name
object.country&.name
end
def state_name
object.state&.abbr
end
end