gazay/gon — Issue #24: Gon variables persisted if no gon variables are set
Author: tommyh
Created: 2012-02-22 00:45:05+00:00
State: open

It appears that the gon variables aren't being cleared out across requests if a gon variable isn't set on the new request.

Steps to recreate:
1. In application layout include_gon
2. Have 2 actions, #foo and #bar.
3. #foo action should have no gon assignments
4. #bar should have gon.a = "b"
5. go to #foo page. include_gon => "" (which is good)
6. go to #bar page. include_gon => "window.gon = {}; gon.a = 'b' "; (which is good)
7. go to #foo page. include_gon => "window.gon = {}; gon.a = 'b' "; (which is bad)

Is this known/desired functionality? My goal was to have "include_gon" in my global application layout, and it would only have variables if I assigned them in the action (or in a before_filter).

Tom

PS Thank you for this gem - I was already using the 2 other methods described in ryanb's railscasts, and gon seems like a much cleaner approach