mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
22 lines
414 B
Ruby
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
|