acl9 doesn't fill created_at

435 Views Asked by At

I followed the acl9 Readme exactly, have double checked everything and still get the following error when trying to use 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?' for nil:NilClass

Any suggestions?

2

There are 2 best solutions below

1
On BEST ANSWER

This is a known issue in 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.

0
On

This was also caused by an error in the acl9 docs (because a habtm join table shouldn't have timestamps). I fixed the docs too, and acl9 1.2 now has a generator for that migration too :)