Forum: Ruby on Rails Setter not being called

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73174d2a6d799c23d0200b2afaed0ee1?d=identicon&s=25 Carlos Kozuszko (Guest)
on 2005-12-25 22:16
(Received via mailing list)
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 Site: http://www.ckozus.com.ar
Blog: http://www.ckozus.com.ar/blog
Mis links: http://del.icio.us/ckozus
This topic is locked and can not be replied to.