Skip to content

ActionDispatch::Session::ActiveRecordStore failed to save session #153

Open
@camiloabrilth1999

Description

@camiloabrilth1999

Hi, I'm doing my own implementation of the session class, logically using this gem to save the sessions in a database.

Although I am aware that the data attribute contains the reference to the user, I customized my session model to add a field called user_id, being referenced in the database.

The problem is with the association in rail models, placing the line belongs_to :user will cause the following error:

   (0.4ms) BEGIN
  ↳ /.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.1/lib/active_record/log_subscriber.rb:98
   (0.3ms) ROLLBACK
  ↳ /.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.4.1/lib/active_record/log_subscriber.rb:98
Warning! ActionDispatch::Session::ActiveRecordStore failed to save session. Content dropped.


ActionController::InvalidAuthenticityToken - ActionController::InvalidAuthenticityToken:
  appsignal (2.10.0) lib/appsignal/rack/rails_instrumentation.rb:19:in 'call

I would like to know if anyone knows how to fix it or if they have any correct implementation of the session model

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions