Any way to stop notify(method) in a model?

I am adding a function to check for 2 digit dates and change them into
4 digit before a Date.new has time to choke on it. My model is :

class Person < ActiveRecord::Base
belongs_to :household

def before_validation

debugger

self.month_int = self.month.to_i
self.day_int = self.day.to_i
self.year_int = self.year.to_i
if (year_int > 0) && (month_int > 0) && (month_int < 13) &&

(day_int > 0)&& (day_int < 32)
if (self.year_int < 100)
@compare = Date.new(2000+self.year_int,self.month_int,
self.day_int)
if (@compare > Date.today)
self.year_int = 1900+self.year_int
else
self.year_int = 2000+self.year_int
end
self.year = self.year_int.to_s
end
self.birthday = Date.new(self.year_int, self.month_int,
self.day_int)
else
errors.add(“Date”)
end
debugger
end

validates_inclusion_of :month_int, :in => 1…12,
:message => “should be between 1 and 12”
validates_inclusion_of :day_int, :in => 1…31,
:message => “should be between 1 and 31”
validates_numericality_of :year_int
validates_inclusion_of :sex, :in => %w{ M F },
:message => “should be ‘M’ or ‘m’ or ‘F’ or ‘f’”
validates_presence_of :sex, :month, :day, :year
validates_date :birthday, :before => Date.today+1, :after => ‘Jan 1
1900’, :before_message => ‘Needs to be today or
before.’, :after_message => ‘Needs to be after 1/1/1900.’

end

since I added the code that changes a model variable, I get 2
breakpoints from the 2 changes. This is not needed by my app and
causes a breakpoint that my user won’t know how to bypass. Please help
with removing this issue. I assume rails is error-checking my code and
having a fit about not telling the views that a field has changed…

Bob [email protected]

On 11 May 2010 21:53, Bob S. [email protected] wrote:

self.year_int = self.year.to_i
self.year = self.year_int.to_s
:message => “should be between 1 and 12”

end

since I added the code that changes a model variable, I get 2
breakpoints from the 2 changes. This is not needed by my app and
causes a breakpoint that my user won’t know how to bypass. Please help
with removing this issue. I assume rails is error-checking my code and
having a fit about not telling the views that a field has changed…

I am confused about exactly what is the problem that you are having.
Is it that the code is stopping at the debugger statement in your
code? If so just remove the debugger statement.

If this is not the problem please be more explicit about what is
happening.

Colin

It acts like I set a breakpoint, but I haven’t. Not sure why, but this
problem vanished last night…

Bob

[Please quote when replying.]

Bob S. wrote:

It acts like I set a breakpoint, but I haven’t. Not sure why, but this
problem vanished last night…

Perhaps the class was cached (which Rails does automatically in
production) and the cached version included the breakpoints? Then if
you restarted the server, it would have reloaded the class.

Bob

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]