Argument out of range

Hi…
I’ve a problem with this :


def fir_tahiti
  @notams=Array.new
  Notam.find_all_notams().each do |notam|
    @notams.push(notam) if (to_secs(notam.debut)<Time.now.to_i and 
to_secs(notam.fin)>Time.now.to_i)
  end
end

def to_secs(str = nil)
  Time.gm(2000+str[0..1].to_i, str[2..3].to_i, str[4..5].to_i, 
str[6..7].to_i, str[8..9].to_i).to_i if str
end

It tells me : “ArgumentError in ListController#fir_tahiti - argument out
of range”.
I already spend hours on this and i can’t find a solution…
Plz help me !!!

Please do not send unsolicited mail to wku.edu email accounts. If you
feel that your message was rejected in error please contact 270-745-7000

It seems that is smth wrong with the string u send as parameter in
to_secs method. Check out if the length of the string is always
greater than 9. And how does str look like?

Cheers,
ioana k&a
http://boulangerie.wordpress.com/

The problems is that i cant send the value of notam.debut and
notam.fin… i can read it (the value is OK), i can give him another
value but something is wrong when I give him as a parameter to a
method…

(Sorry for my poor english :wink: )

Please do not send unsolicited mail to wku.edu email accounts. If you
feel that your message was rejected in error please contact 270-745-7000

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs