Closed luisramos0 closed 6 years ago
This serializer is used to inject data into the dom in:
And also used to inject data into this view:
From analysing these parts of the htmland angular code, I havent found any use of shipping_method_ids coming from Api::Admin::BasicEnterpriseSerializer. Please correct me if I am wrong. Anyway, I think we should keep it there as shipping_methods should be part of the basic info about an enterprise.
There's no order.shipping_method_id in this serializer, it's enterprise.shipping_method_ids.
On the way, I have learned some active record magic here:
"When you declare a has_many association, the declaring class automatically gains 16 methods related to the association"
One of these is collection_singular_ids
so
In Enterprise
has_many :shipping_methods
creates shipping_method_ids
that is used in the basic_enterprise_serializer.
So, because enterprise.shipping_methods (table distributors_shipping_methods) is still available in 2-0-stable, nothing will change here and there's nothing to do here. Closing issue.
app/serializers/api/admin/basic_enterprise_serializer.rb: 1 class Api::Admin::BasicEnterpriseSerializer < ActiveModel::Serializer 2: attributes ... :shipping_method_ids