Silence Active Support warning about @dirty not being initialized #5237

wants to merge 1 commit into


None yet
2 participants

rohit commented Mar 2, 2012

Running the Active Support tests gives one warning from within Active Support:

/home/rohit/projects/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb:130: warning: instance variable @dirty not initialized

On checking the code it seems like the intention is to set :@dirty to nil. On doing that the tests pass and the warning doesn't appear. If I'm wrong can somebody explain? :)


drogus commented Mar 2, 2012

@dirty does not need to be nil here, I don't think that's a good fix

drogus closed this Mar 2, 2012


rohit commented Mar 2, 2012

@drogus Ok, thanks for looking at this. I'll take a look at the code in more detail.

@brigade-gerrit brigade-gerrit pushed a commit to causes/rails that referenced this pull request Nov 15, 2013

@carlosantoniodasilva carlosantoniodasilva Stop SafeBuffer#clone_empty from issuing warnings
Logic in clone_empty method was dealing with old @dirty variable, which
has changed by @html_safe in this commit:

This was issuing a "not initialized variable" warning - related to:

The logic applied by this method is already handled by the [] override,
so there is no need to reset the variable here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment