I am running into a problem with to_json not rendering my virtual attributes
class Location < ActiveRecord::Base belongs_to :event before_create :g
I tried François Beausoleil's answer and got it to work after modifying to_json to as_json
to_json
as_json
def as_json(options={}) options[:methods] ||= [] options[:methods] << :class_to_s super(options) end