简体   繁体   English

acl9无法填充created_at

[英]acl9 doesn't fill created_at

I followed the acl9 Readme exactly, have double checked everything and still get the following error when trying to use has_role!(:admin) . 我完全遵循了acl9自述文件,仔细检查了所有内容,并在尝试使用has_role!(:admin)时仍然收到以下错误。

ActiveRecord::StatementInvalid: SQLite3::ConstraintException: roles_users.created_at may not be NULL: INSERT INTO "roles_users" ("user_id", "role_id") VALUES (1, 1)

The only catch is that I am using Rails 3.2 and used the following fix for an error: Rails 3.2 undefined method `key?' 唯一的问题是我正在使用Rails 3.2并针对错误使用了以下修复程序: Rails 3.2 undefined method`key?' for nil:NilClass 对于nil:NilClass

Any suggestions? 有什么建议么?

This is a known issue in rails. 这是Rails中的一个已知问题。 Hopefully it will be resolved and reported on here . 希望它将在这里得到解决和报告。

I fixed it by eliminated the has_and_belongs_to_many lines from the corresponding model class, and for some reason that made it go away. 我通过消除相应模型类中的has_and_belongs_to_many行来修复它,并且由于某种原因使它消失了。

This was also caused by an error in the acl9 docs (because a habtm join table shouldn't have timestamps). 这也是由acl9文档中的错误引起的(因为habtm连接表不应具有时间戳记)。 I fixed the docs too, and acl9 1.2 now has a generator for that migration too :) 我也修复了文档 ,并且acl9 1.2现在也为该迁移提供了一个生成器:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM