First model:
第一个型号:
class AdPlace < ActiveRecord::Base
belongs_to :user
has_many :user_ads, dependent: :destroy
accepts_nested_attributes_for :user_ads, allow_destroy: true, reject_if: :all_blank
def ad_places_json
self.as_json(
include: {
user_ads: {
}
})
end
end
class AdPlace < Active