title: Ruby on Rails - ApplicationController
body: <p>Am working on some guest account feature in my game application.If u register as a game user then devise gem loads the current account id to the session automatically. But when a user is a guest, am creating a account and a user type object with hard coded values and saving that to the database successfully. But when I try to store the object into the session its not working properly.</p>
  
  <p>My code is like this,</p>
  
  <pre><code>def play_as_guest
     account = Account.new(email: "guest_#{Time.now.to_i}#{rand(99)}@eossys.com", password: "password", is_guest: true)
     account.save
     game_user = GameUser.new(account: account, game_profile_attributes: {first_name: "Guest", last_name: "guest", nick_name: "guest"})
     game_user.save
     session[:current_account] = game_user
     redirect_to "/game_profiles/#{account.id}/summary"
  end
  </code></pre>
  
  <p>If i store the account obj
  session[:current_account] = game_user</p>
  
  <p>this is throwing an error of "ActionDispatch::Cookies::CookieOverflow in HomeController#play_as_guest"</p>
  
  <p>if I try
  session[:current_account_account] = account</p>
  
  <p>its not working, because after redirecting its again asking for the login. since I am using the 'authenticate_account!' filter in every class.</p>
  
  <p>What I want basically is to load the account object I have created into the session, like as if its a registered user.  </p>
  
  <p>Thanks for the help in advance.</p>