From: Jeremy Evans Date: 2009-09-29T02:28:48+09:00 Subject: Re: Sequel accessor methods Jake Brightmatter wrote: > the FAQ link is broken so forgive if i screw up some forum rule > > I am trying to add to a SEQUEL database like this: > [code] > def new_house( self_id ) > if DataBase[:house].where( :id => self_id ).exists == false then > DataBase[:house].insert(:id => self_id) > end > end > [/code] > I am trying to check to see if there is a 'house' with that id and if > there is not one, make it. It does not work. Any suggestions? Sequel doesn't have an FAQ, but the documentation website is up (http://sequel.rubyforge.org/documentation.html). Dataset#exists doesn't do what you think it does. Try: def new_house( self_id ) DataBase[:house].insert(:id => self_id) unless DataBase[:house][:id => self_id] end Jeremy -- Posted via http://www.ruby-forum.com/.