ruby on rails - Non-persisted field in Mongoid -


can define field in mongoid, not persist it? need to_json include field, , using attr_accessor , after_initialize calculate value not include in to_json result.

solved manipuating json array itself, keeping of to_json power.

raw((c.to_json).insert(-2, ",\"url\":#{c.image_url.to_json}")) 

Comments