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?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.