How to extract all attributes with Rails Jbuilder?

前端 未结 6 1150
無奈伤痛
無奈伤痛 2020-12-11 00:16

It\'s a pain to write codes like this all the time in jbuilder.json template:

json.extract! notification, :id, :user_id, :notice_type, :message, :resource_ty         


        
6条回答
  •  無奈伤痛
    2020-12-11 00:56

    You may look at json.except!

    json.except! @resource, :id, :updated_at

    json.except! @resource

    https://github.com/chenqingspring/jbuilder-except

提交回复
热议问题