Topic: Overriding mutator methods
I've come across a confusing situation in my Rails 2.3/Hobo 1.0 app.
I have the overridden the mutator methods for a belongs_to field:
if( country.id.nil? )
country_id = nil
country_id = country.id
self.currency = self.country.currency if( not self.country.nil? )
self.currency_id = self.country.currency_id if( not self.country.nil? )
The confusion arises because this appears to work in the application (if I change the country on the company page, the currency is changed for the company as well). This does not work in unit testing, though, so I assume there must be something wrong with it.
Thanks in advance.