Howdy all.  I'm trying to figure something out and having some issues
nailing down the appropriate syntax in my model file for the
following scenario:

HOSTS
----------
id (pk)
name
cpu_count
mem_count
status


MOUNTS
---------
id (pk)
host_id (fk)
name
path
type


HOST_TYPE
---------
id (pk)
name
description


class Host < Sequel::Model(:hosts)
  one_to_many :mounts, class: Mount, key: :host_id
end


class Mount < Sequel::Model(:mounts)
  many_to_one :host, key: :host_id, class: Host
end


class HostType < Sequel::Model(:host_types)
  one_to_many :hosts, key: :host_type_id
end


No physical table (join table) exists for hosts and host_type.

I'm writing an API and an enhancement request has come in where the client
wants an endpoint for mounts with the ability to search/filtering on
host_type.  So far the things I've tried come close but seem to end with a
join like:  ... AS host_type ON (host_type.id = mount.host_id)...

Additional info, I am using eager_graph.  I think I know what I want, just
not sure how to set things up using Sequel to do it.   Basically, if the
client wants to filter on 'METAL' as a host type, I want to show all mounts
for all hosts that have a host_type of 'METAL'.

Hopefully I'm missing something simple that I've overlooked.  Going to do
some more digging but thought I'd ask here to expedite a solution.

Thanks,

HOGI....

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CAF%3DXP2LCvCLNU9DT_QAsDHjre4fQiFKu_7k3XTNRFuis7b1_Jg%40mail.gmail.com.

Reply via email to