activerecord-session_store: null value in column "session_id" violates not-null constraint
Just switched to this gem, using Rails 4 beta. When creating a new session I am getting this error. From my specs:
1) FacebookAuths creates a user after authenticating with facebook
Failure/Error: click_link "Sign in with Facebook"
ActiveRecord::StatementInvalid:
PG::Error: ERROR: null value in column "session_id" violates not-null constraint
DETAIL: Failing row contains (1, null, BAh7B0kiFG9tbmlhdXRoLnBhcmFtcwY6BkVGewBJIhRvbW5pYXV0aC5vcmln
aW4..., 2013-01-07 22:08:28.269912, 2013-01-07 22:08:28.269912).
: INSERT INTO "sessions" ("created_at", "data", "updated_at") VALUES ($1, $2, $3) RETURNING "id"
# ./spec/features/facebook_auths_spec.rb:7:in `block (2 levels) in <top (required)>'
Not sure what I am doing wrong. It had been working fine with the cookie store, but I got the Cookie Overflow error when I switched to the encrypted cookie store, which is how I ended up here. I am not sure if there is something else I need to change.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 16 (1 by maintainers)
Commits related to this issue
- got past session store silliness https://github.com/rails/activerecord-session_store/issues/6#issuecomment-26214581 — committed to shaunagraham/mettleme by seanewest 10 years ago
- updating user and introducing session_store WRT https://github.com/rails/activerecord-session_store/issues/6 — committed to moneyadviceservice/frontend by JiggyPete 10 years ago
- updating user and introducing session_store WRT https://github.com/rails/activerecord-session_store/issues/6 — committed to moneyadviceservice/frontend by JiggyPete 10 years ago
- updating user and introducing session_store WRT https://github.com/rails/activerecord-session_store/issues/6 — committed to moneyadviceservice/frontend by JiggyPete 10 years ago
- updating user and introducing session_store WRT https://github.com/rails/activerecord-session_store/issues/6 — committed to moneyadviceservice/frontend by JiggyPete 10 years ago
- Properly set `attr_accessible` for the model We could tell that user uses protected_attributes gem by looking for `accessible_attributes` method. Note that there's no test for this. I've tried to ad... — committed to rails/activerecord-session_store by deleted user 9 years ago
- * sessions stored in database * workaround for a rails4 bug (sessions could not stored) https://github.com/rails/activerecord-session_store/issues/6 — committed to Messinger/ispconfig-dyndns by deleted user 10 years ago
Just put this code in an initializer and you should be fine (better yet, get rid of attr_accessible)