Rails: attr_accessor doesn't show up when try to render as JSON Rails: attr_accessor doesn't show up when try to render as JSON json json

Rails: attr_accessor doesn't show up when try to render as JSON


Is clientAvailability a column in the DB? If not, then I suppose it is the default way - to serialize only the DB attributes. But you can do:

render json: init, methods: [:clientAvailability]

to include clientAvailability attribute.