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

Most upvoted comments

Just put this code in an initializer and you should be fine (better yet, get rid of attr_accessible)

ActiveRecord::SessionStore::Session.attr_accessible :data, :session_id