Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4619416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:25:17+00:00 2026-05-22T02:25:17+00:00

Even though I’m pretty sure I know why this error gets raised, I don’t

  • 0

Even though I’m pretty sure I know why this error gets raised, I don’t seem to know why or how my session is exceeding the 4KB limit…

My app was working fine, but once I deliberately started adding bugs to see if my transactions were rolling back I started getting this error.

To give some background, I’m busy coding a tournament application that (in this section) will create the tournament and then add some tournament legs based on the number of teams as well as populate the the tournament with some ‘ghost fixtures’ once the legs have been created.

The flash[:tournament] was working correctly before; using a tournament object, I have access to any AR validation errors as well as data that has been entered on the previous page to create the tournament.

TournamentController.rb

begin
  <other code>
  Tournament.transaction do
    tournament.save!
    Tournament.generate_legs tournament
    Tournament.generate_ghost_fixtures tournament
  end

  flash[:notice] = "Tournament created!"
  redirect_to :action => :index
rescue Exception => e
  flash[:tournament] = tournament
  redirect_to :action => :new, :notice => "There was an error!"
end

Tournament.rb

self.generate_ghost_fixtures(tournament)
  <other code>
  #Generate the ghost fixtures
  #tournament_legs is a has_many association
  tournament_legs_array = tournament.tournament_legs

  tournament_legs_array.each do |leg|
    number_of_fixtures = matches[leg.leg_code]

    #For the first round of a 32 team tournament, this block will run 16 times to create the matches
    number_of_fixtures.times do |n|
      Fixture.creatse!(:tournament_leg_id => leg.id, :match_code => "#{leg.leg_code}-#{n+1}")
    end
  end
end

I can do nothing but speculate as to why my session variable is exceeding 4KB??
Is it possible that the tournament object I pass through the flash variable contains all the associations as well?

Here is the dump of my session once I get the error.

Hope this is enough info to help me out 🙂

Thanks

Session Dump

_csrf_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
flash: {:tournament=>#<Tournament id: nil, tournament_name: "asd", tournament_description: "asdasd", game_id: 1, number_of_teams: 16, start_date: "2011-04-30 00:00:00", tournament_style: "single elimination", tournament_status: "Drafting", active: true, created_at: "2011-04-30 10:07:28", updated_at: "2011-04-30 10:07:28">}
player_id: 1
session_id: "4e5119cbaee3d5d09111f49cf47aa8fa"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:25:18+00:00Added an answer on May 22, 2026 at 2:25 am

    About dependencies, it is possible. Also save an ActiveRecord instance in the session is not a recommended aproach. You should save only the id. If you need it in all your requests use a before filter to retrieve it.

    You can read more why is a bad idea at: http://asciicasts.com/episodes/13-dangers-of-model-in-session

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Even though I know that, at least to my knowledge, this is not the
even though php page's header set to UTF-8 i get this error here is
I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState=false
My application uses some session variables that are timing out even though I thought
Even though the solution is so obvious I should have never have posted this,
Even though the solution is so obvious I should have never have posted this,
Even though Interface Builder is aware of a MyClass , I get an error
Even though It has a performance issue, may I know what is the use
Im getting this warning even though theres no possibility that it would remain uninitialized.
This is a very complicated question even though it looks simple. I think I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.