Ahh...I see. Was getting in a bit of a muddle with this and didn't realise
that's what was happening, my bad.

Thanks for replying.

On Wed, 26 Aug 2015 at 19:56 Jeremy Evans <[email protected]> wrote:

> On Wednesday, August 26, 2015 at 11:05:47 AM UTC-7, James Cook wrote:
>>
>> I noticed today that calling update on a single record does not commit
>> changes to the database. This seems like the same odd behaviour being
>> described above.
>>
>> For example...
>> DB[:table_name].insert(name: "Foo")
>> => {id:1, name: "Foo"}
>> DB[:table_name].first.update(name: "Bar")
>> =>{id: 1, name: "Bar"}
>> DB[:table_name].first
>> =>{id:1, name:"Foo"}
>>
>> So, updating a record will return the record with the updated value, but
>> when reloading the record, it has reverted to it's previous state.
>>
>> Is this expected behaviour? If so, why?
>>
>
> Yes.  Here you are calling Hash#update, not Sequel::Model#update.
> Hash#update only modifies the hash, it doesn't affect the database.
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sequel-talk" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sequel-talk/9ZnSNxOW8zU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sequel-talk.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to