I’ve got group of updates that I call in certain cases. They update
data in different tables if specific conditions are met when a new row
is saved to the “drive” (see below) database table. I suspect that I
should make a method out of the group and reuse it in all the cases,
but when I do that I’m getting errors that one of the objects is null.
Here’s what the method should look like, but it’s not functioning when
called.
I’ve got group of updates that I call in certain cases. They update
data in different tables if specific conditions are met when a new row
is saved to the “drive” (see below) database table. I suspect that I
should make a method out of the group and reuse it in all the cases,
but when I do that I’m getting errors that one of the objects is null.
Here’s what the method should look like, but it’s not functioning when
called.
Should I be passing arguments to this method? Or perhaps it should be
in the model and not in the controller?
Any direction to sample code where a update method is created are
reused would be greatly appreciated.
Thanks for any help!!
Bob.
Bob,
My guess is that goal is the null object; it is a local variable as
written (without a preceding glyph), but is not initialized within this
context. Perhaps you mean @goal if it is an instance variable?