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

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -