开发者

Rails: how do attributes become protected (without any invocation of attr_protected or attr_accessible)?

开发者 https://www.devze.com 2023-03-09 06:26 出处:网络
I\'m getting the \"WARNING: Can\'t m开发者_如何学编程ass-assign protected attributes: type\", but I don\'t have any calls to attr_accessible or attr_protected in my code.

I'm getting the "WARNING: Can't m开发者_如何学编程ass-assign protected attributes: type", but I don't have any calls to attr_accessible or attr_protected in my code.

Is there anything else that might cause an attribute to become protected?

I'm not so keen on adding all attributes to an attr_accessiblestatement, because that becomes just one more thing to maintain.


The type attribute is reserved for internal use for single table inheritance.

You should be able to use type by setting the set_inheritance_column

set_inheritance_column :kind # change to something other than :type.


Check out: Rails attr_accessible does not work for :type?

:type is your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消