jeudi 28 septembre 2017

access filter model in data base

I start in Ruby and Ruby on rails. I am trying to modify the access to this object (below) in base via the orm and I will like to filter by the values that are in the table node_tags.

def map
......
  nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(MAX_NUMBER_OF_NODES + 1)
.....
end

probabli on sql requet

SELECT * FROM nodes n INNER JOIN node_tags nt on  n.node_id = nt.node_id where nt.k = 'alert' and nt.v = 'true'

thanks

Aucun commentaire:

Enregistrer un commentaire