Files
openfoodnetwork/app/serializers/api/enterprise_thin_serializer.rb
2019-06-12 09:47:01 +01:00

22 lines
414 B
Ruby

module Api
class EnterpriseThinSerializer < ActiveModel::Serializer
attributes :name, :id, :active, :path
has_one :address, serializer: Api::AddressSerializer
def active
enterprise.ready_for_checkout? && OrderCycle.active.with_distributor(enterprise).exists?
end
def path
enterprise_shop_path(enterprise)
end
private
def enterprise
object
end
end
end