michel med

Joined

170 Experience
1 Lesson Completed
0 Questions Solved

Activity

Thank you :)

Posted in Forum Series Part 1: Architecture Discussion

Thank you for this

Posted in How to use LIKE to query a jsonb field

Hi guys, am really stuck with this, I have a jonb field called occurrences, and one of my records has this on it :

[{"occurs_on"=>"2019-02-04 23:00:00 UTC", "status"=>"none"}, 
{"occurs_on"=>"2019-02-05 23:00:00 UTC", "status"=>"none"}]

am trying do a query that check if there is any record with the date 2019-02-04

I tried this :

Event.where("events.occurrences ->> :key LIKE :value", 
:key => 'occurs_on', :value => '2019-02-04%')

But not working for me, any idea?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.