Using Rails 7, Active record sql server adapter and SQL server 2016. I have a model called requests which has a field called properties where I am storing a json list of fields and values. Here is how the field value looks:
{"summary":"Need bed raised","optional_information":"too low","location":"26679","reported_phone":"(555) 334-1324","reported_email":"mail@mail.com","affected_person_id":"1231232","affected_person_name":"testuserJ ","affected_person_phone":"(555) 334-1324","affected_person_email":"mail@mail.com"}
I am trying to query based on rails params like this:
@request = current_user.requests.where("properties->'summary' LIKE ?", "%#{params[:filter]}%") if params[:filter].present?
I am getting a syntax error TinyTds::Error: Incorrect syntax near '>'.
Does anyone know how to query these sort of fields with a like wildcard?
Using Rails 7, Active record sql server adapter and SQL server 2016. I have a model called requests which has a field called properties where I am storing a json list of fields and values. Here is how the field value looks:
{"summary":"Need bed raised","optional_information":"too low","location":"26679","reported_phone":"(555) 334-1324","reported_email":"mail@mail.com","affected_person_id":"1231232","affected_person_name":"testuserJ ","affected_person_phone":"(555) 334-1324","affected_person_email":"mail@mail.com"}
I am trying to query based on rails params like this:
@request = current_user.requests.where("properties->'summary' LIKE ?", "%#{params[:filter]}%") if params[:filter].present?
I am getting a syntax error TinyTds::Error: Incorrect syntax near '>'.
Does anyone know how to query these sort of fields with a like wildcard?