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

Bob

On May 11, 5:18 pm, Colin Law <[email protected]> wrote:
> On 11 May 2010 21:53, Bob Smith <[email protected]> wrote:
>
>
>
> > 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..
>
> 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
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to