即使我敢肯定,我知道爲什麼這個錯誤被提出,似乎我不知道爲什麼或怎麼我的會話超過4KB限制...幫助調試我的會話? Rails 3塊中ActionDispatch ::餅乾:: CookieOverflow
我的應用程序工作正常,但一旦我故意開始添加錯誤以查看我的事務是否回滾,我開始出現此錯誤。
爲了給出一些背景知識,我正在忙着編寫一個錦標賽應用程序(在本節中)來創建錦標賽,然後根據錦標賽隊伍的數量添加一些錦標賽腿以及用一些「幽靈」填充錦標賽一旦腿已經被創建,燈具就會被關閉。
flash [:tournament]之前正常工作;使用錦標賽對象,我可以訪問任何AR驗證錯誤以及在上一頁輸入的用於創建錦標賽的數據。
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
我能做的只是猜測,爲什麼我的會話變量超過4KB? 我有可能通過flash變量傳遞的錦標賽對象也包含所有關聯嗎?
這裏是我的會話轉儲一旦我得到錯誤。
希望這是足夠的信息來幫助我:)
感謝
會議自卸
_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"
看來,在救援條款中的flash [:tournament] =錦標賽是罪魁禍首。 – Roman 2011-05-07 08:42:04
是的,這是罪魁禍首,我想知道的是,地獄是如何超過4KB ...:D協會?我不知道。 – 2011-05-23 18:47:01