top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to clear/reset a corrupt session in Rails

+1 vote
495 views

We have a rails 2.3 app with a large number of live users, and we have recently done something to corrupt some users sessions in such a way that any attempt to use the session object itself raises an exception. "reset_session" is also raising the same exception, and not clearing the session.

Is there a lower-level way to clear the session from the app that doesn't require the session to be valid? We are using the cookie session_store.

What is really surprsing to me is that even "cookies['our_cookie_label']=nil" raises the exception.

The exception is this: "ActionController::SessionRestoreError (Session contains objects whose class definition isn't available. Remember to require the classes for all objects kept in the session.
(Original exception: #{const_error.message} [#{const_error.class}])"

Unfortunately, since we can't read the session at all, I can't figure out what object is in it that isn't defined.

posted May 22, 2014 by Deepankar Dubey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Have you tried changing the secret, so all existing cookies are invalidated? Look in the initializers for secret_token.rb (may be somewhere else on 2.3, can't recall exactly).

answer May 22, 2014 by anonymous
Similar Questions
+1 vote

I am lost in an update. updated rails 3 to 4 and now stuck with devise...

I have updated views and controller code & user.rb, but I don't know where the error comes from...nor do I see the same reset token in the database.

0 votes

Is it is possible to share a Rails 4 session with a Rails 4.1 application with the same secret key base on the same domain name. This works with Rails 4 to Rails 4 but it appears that my cookies are being encrypted differently between the two versions.

Any suggestions?

+1 vote

I have a project model which I'd like to set the default_scope to filter out projects where the user doesn't have permission to view them.

Think something along the lines of the projects having a list of teams and companies that the user must be in to access the data.

default_scope seems to work well if I hard code it as I really don't want a dev to accidentally not have these permissions filters in use. The lists of teams and companies a user is in is stored in the session.

+2 votes

I have a table with several thousand records in it. They take a long time to load and are essentially useless presented altogether.. I'd like present the user a search form to select a limited subset of records for display in the index function. What options are available to solve this problem and where might I look for examples or demos?

+1 vote

I want to create 3 rails apps in which every app has a Google API.
1) Gmail API
2) Google+ API 3
3) Google calendar API

Please suggest how to begin with...

...