Setter not being called


#1

I have written the followign setter to raise an exception when the field
disabled_on is beeing assigned a value minor or equal that the
enabled_on
field.

class Survey < ActiveRecord::Base
def disabled_on=(date)
raise AssignmentException if date != nil and date <= self.enabled_on
write_attribute(:disabled_on, date)
end
end

The matter is that this method never gets called, as I can assure adding
a
breakpoint() as its first line.

I’ve also written a test to check for this exception:

assert_raise (AssignmentException) {
@survey.disabled_on = @survey.enabled_on
}

Of course this test doesn’t pass, becouse the disabled_on=() method
never is
called.

Any clues ?

TIA,

ckozus.


Web S.: http://www.ckozus.com.ar
Blog: http://www.ckozus.com.ar/blog
Mis links: http://del.icio.us/ckozus