Files
openfoodnetwork/app/serializers/api/admin/proxy_order_serializer.rb
Rob Harrington 3d3013a592 WIP: ProxyOrders don't require an order, adding an edit path for proxy orders
initialises an order if one does not exist and redirects to its edit path
2018-02-09 14:43:55 +11:00

16 lines
370 B
Ruby

class Api::Admin::ProxyOrderSerializer < ActiveModel::Serializer
attributes :id, :state, :edit_path, :number, :completed_at, :order_cycle_id, :total
def total
object.total.to_money.to_s
end
def completed_at
object.completed_at.blank? ? "" : object.completed_at.strftime("%F %T")
end
def edit_path
edit_admin_proxy_order_path(object)
end
end