Field aliases with Mongoid and Rails

前端 未结 3 696
萌比男神i
萌比男神i 2021-01-02 13:56

It\'s common practice in MongoDB to use short key names to save space. For example, one might want to use \"fn\" instead of \"first_name\"

However in your app, you\

3条回答
  •  自闭症患者
    2021-01-02 14:42

    you should consider using

     field :fn, :as => :firstname
    

    as outlined here: http://groups.google.com/group/mongoid/browse_thread/thread/ce3298d6a167bd70

    this is a very good practice which is fully supported in mongoid.

提交回复
热议问题