Dynamic attributes with Rails and Mongoid

后端 未结 4 846
自闭症患者
自闭症患者 2020-12-13 07:28

I\'m learning MongoDB through the Mongoid Ruby gem with Rails (Rails 3 beta 3), and I\'m trying to come up with a way to create dynamic attributes on a model based on fields

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 08:10

    Mongoid doesn't really support it.

    I happen to have asked this at Mongoid group myself.

    It is possible when you create new document, like this:

    account = Account.new(:some_dynamic_field => "...")

提交回复
热议问题