Yes, previous_plan is a reference to @customer_plan and so changes
with it. Instead of
previous_plan = @customer.plan
This should work with something like
previous_plan = @customer.plan.dup
Which makes previous_plan a copy rather than a reference.
Though not a huge deal, this to me is one of the more annoying and
confusing bits of Ruby. It uses references in many places where I'd
think it would just copy values. And the difference between dup and
clone is poorly documented or mysterious or both.