Switching enterprise index to its own dedicated serializer, so we can spit out ownership

This commit is contained in:
Rob Harrington
2015-06-11 10:38:05 +08:00
parent 5a08344812
commit e575b0e490
7 changed files with 57 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
class Api::Admin::BasicEnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :is_primary_producer, :is_distributor, :sells, :category, :payment_method_ids, :shipping_method_ids
attributes :producer_profile_only, :permalink
attributes :producer_profile_only
end

View File

@@ -0,0 +1,8 @@
class Api::Admin::IndexEnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :permalink, :is_primary_producer, :sells, :producer_profile_only, :owned
def owned
return true if options[:spree_current_user].admin?
object.owner == options[:spree_current_user]
end
end