Deprecation warning for creating attribute 'currency'

感情迁移 提交于 2019-11-29 10:01:32

Apparently in Rails 3.2 and above arbitrary attributes (attributes not stored in the database) are no longer allowed. There doesn't seem to be a way around it.

Here is the commit for the deprecation message: https://github.com/rails/rails/commit/b2955edc and here is why: https://github.com/rails/rails/commit/50d395f96ea05da1e02459688e94bff5872c307b

In your case price_cents and currency still need to be stored in the database and then your composed class will take it from there.

Added 'currency:string' to my model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!