阅读背景:

内部json对象不呈现Rails

来源:互联网 

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



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: