Getting a 'true' value out of a method?

Hi I wrote this method to check for the availability of a studio :

def check_dispo(date, time, time_duration, week_duration)
i = 0
end_time = time + time_duration.strftime(’%H’).to_i3600 +
time_duration.strftime(’%M’).to_i
60
while i < week_duration
studio_bookings = StudioBooking.find(:all, :conditions =>
[“start_date = ?”, date])
for studio_booking in studio_bookings
studio_booking_end_time = studio_booking.time +
studio_booking.time_duration.strftime(’%H’).to_i3600 +
studio_booking.time_duration.strftime(’%M’).to_i
60
unless time >= studio_booking_end_time || end_time <=
studio_booking.time
return false
end
end
i += 1
date = date + 7
end
return true
end

it returns false in case it’s booked but returns ‘nil’ instead of true
otherwise :frowning:

HELP PLEASE !!!

Pat

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