From: Jake Brightmatter Date: 2009-09-30T03:12:31+09:00 Subject: Re: Sequel accessor methods > def find_unused_house_id(start_point = 0) > while (DataBase[:house][:id => start_point]) > start_point += 1 > end > start_point > end This is what I had written when you came alone. def find_unused_house_id() parking_spot_number = 0 while(DataBase[:house][:id => parking_spot_number]) parking_spot_number += 1 end return parking_spot_number end eerie right?! You were right on the money of what I wanted. I had assumed that a 'nil' return would be taken as false. By your code example, i was correct to assume that. I also was explicitly returning the value, why didn't you? Is that a ruby thing? My only issue is that this does not work and I don't know why. I have essentially what you have right? It should be noted that I am calling this function in an odd way. I am using JavaScript from a *.rhtml file using a direct 'request' via this code: var myHouseRequest = new Request({ url: "/find_unused_house_id/" }).send(); now I explicitly returned the count from ruby but I have no access to the variable 'parking_spot_number' from the JavaScript. At least I don't think I do. So although I think the ruby code should work, I have no proof that it is working. -- Posted via http://www.ruby-forum.com/.