This line is causing the change:
conditions_string = self.sql_for_non_null_coordinates
But why? And is it possible to prevent this behaviour?
Hi Nick,
This is because Ruby constants are not constants. They can change.
Ruby warns you when you reinitialize a constant, but not otherwise.
That is,
Constant << “anything”
won’t produce a warning.
You should use something like,
conditions_string = self.sql_for_non_null_coordinates.dup
…
Hi Nick,
This is because Ruby constants are not constants. They can change.
Ruby warns you when you reinitialize a constant, but not otherwise.
That is,
Constant << “anything”
won’t produce a warning.
You should use something like,
conditions_string = self.sql_for_non_null_coordinates.dup
…
Thanks for the tip, Kazim! That answers my question perfectly.
Cheers,
Nick
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.