Closed kmcphillips closed 6 years ago
In some cases, where we are overriding the names of the properties used, we will read an ivar that does not yet exist.
It will return nil but ruby will spit out a warning.
nil
Here we guard against that and just have it return nil without reading if it is not defined. Removes these warnings:
/measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_length not initialized /measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_total_weight not initialized /measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_width not initialized /measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_width not initialized /measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_width not initialized /measured-rails/lib/measured/rails/active_record.rb:37: warning: instance variable @measured_width not initialized
In some cases, where we are overriding the names of the properties used, we will read an ivar that does not yet exist.
It will return
nil
but ruby will spit out a warning.Here we guard against that and just have it return
nil
without reading if it is not defined. Removes these warnings: