我的模型中有方法
def indexed_json
to_json(
only: [:id, :chanell_id, :title],
include: [
:locations,
{categories: {only: [:name, :id]}}
]
)
end
我想在 JBuilder 中重写它并添加另一个属性:type_name: self.class.name
我的模型中有方法
def indexed_json
to_json(
only: [:id, :chanell_id, :title],
include: [
:locations,
{categories: {only: [:name, :id]}}
]
)
end
我想在 JBuilder 中重写它并添加另一个属性:type_name: self.class.name