@model.map(&:attributes) and virtual attributes

534 Views Asked by At

How can i use @model.map(&:attributes) to make it so that virtual attributes show up in when I render @model as json

1

There are 1 best solutions below

1
On BEST ANSWER
@model.to_json(:method => ['virtual_attribute1', 'virtual_attribute2']))

Didn't understand the map call either