我在rails控制台上收到了以下弃用警告:
DEPRECATION WARNING: Having additional attributes on the join table of a
has_and_belongs_to_many association is deprecated and will be removed in Rails 3.1.
Please use a has_many :through association instead.问题出在我根据在线分步教程创建的roles_users表中。
如何为acl9实现has_many :through关联?这超出了我的能力范围,特别是因为user和role模型都只使用助手方法,而没有实际的has_and_belongs_to_many。
下面是它们的外观:
class User < ActiveRecord::Base
acts_as_authentic
acts_as_authorization_subject :association_name => :roles
end
class Role < ActiveRecord::Base
acts_as_authorization_role
end发布于 2012-03-08 07:50:12
答案后来在这个GitHub问题的评论中进行了讨论。
用户模型:
acts_as_authorization_subject :association_name => :roles, :join_table_name => :roles_users角色模型:
acts_as_authorization_role :join_table_name => :roles_users发布于 2015-01-23 05:08:52
另外,根据记录,Rails最终决定不推荐使用habtm的:join_table选项,所以这一点随着Rails的后续补丁发布而消失了。如果你只是升级你的Rails,你不应该需要这个问题中提到的选项。
https://stackoverflow.com/questions/6696948
复制相似问题