Ah I see. I've been moving methods around in my select statements so I didn't notice any progression of activity.
Just tested a *.returning(:id, :bravo)* method and it didn't work post *update*, but did after *where*. Cheers On Wednesday, August 12, 2020 at 5:29:28 PM UTC-4 Jeremy Evans wrote: > On Wednesday, August 12, 2020 at 1:15:56 PM UTC-7, bee...@gmail.com wrote: >> >> Having some trouble with updating a single field. *target* is a >> generated integer, as to which record to update, and *dings* is my >> current full dataset, and *newvalue *is a new string. >> >> dings = DBHR[:dingbats] >> newvalue = Dev.genp >> ids = dings.select(:id).map(:id) >> target = ids.sample >> dings.update(bravo: newvalue).where(id: target) >> >> ==> undefined method 'where' >> >> I'm not sure what the error is for, as it seems legit. It is qualifying >> the record to update, and instructing what update to be made. >> > > No, you are calling where on the result of Dataset#update, which is after > the UPDATE query has been sent. What you did is update all records in the > dingbats table, since there wasn't a filtering method called before the > update. The NoMethodError is because Dataset#update returns an integer > (number of records updated), and Integer#where is not defined. You must > call where before update. This is discussed in the README: > http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Updating+Records > > Thanks, > Jeremy > > > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/2885f41c-d318-4859-b0f8-1c849b9eb93an%40googlegroups.com.