ruby on rails - How to search through array of strings using BETWEEN in Active Record POSTGRES, -


subscriptions     canceled_at: ["2017-04-07t09:52:17-05:00", "2017-04-01t09:52:17-05:00"] 

canceled_at array of strings. each element datetime converted string.

above subscriptions table. trying query through , find records have canceled_at date within given week.

date = date.today  subscription.where("any subscriptions.canceled_at      between '#{date.beginning_of_week(:sunday)}'      , '#{date.end_of_week(:sunday)}'" 

ruby 2.3.1p112

subscription.where(canceled_at:(date.beginning_of_week(:sunday)..date.end_of_week(:sunday))) 

edit: missing closing parentheses


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -