So I have a many to many relationship. I am storing a status string on the join table.
Example: Order has many Items on it. Items are fixed. On the OrdersItems table we store a string called item_status. I want to return the Order using as_json.
def as_json(options={})
opts = {
only: PUBLIC_ATTRIBUTES,
methods: [:items],
}.merge(options){|k,o,n|o|n}
super(opts)
end
This works, except I want to add that item_status to each hash in the items array. How can I do this?