I am using mongo db and I got one weird problem when calling to_json method.
Suppose I have a model station. Now I can see _type attribute when I go for Station.first and even I can see the attribute when converted to json using Station.first.to_json(:only => [:_type])
But the problem is simply doing ` Station.first.to_json ‘ just excludes _type attribute but finely shows other attributes. Can you guys help me out on this?
I am using rails 3.1.1 and mongoid 2.3.3
Use
Station.first.to_json(:methods => :_type).