Hi all,

I use Sequel to model two tables using a one_to_many association:

class Node < Sequel::Model
  one_to_many :node_data
end

class NodeDatum < Sequel::Model
  many_to_one :node
end


And I get data from the DB using the following Sequel call: 

results = Node.where(:name=>name)
  .eager_graph(:node_data)
  .order(:id).all.map { |a| a.values.merge(:node_data=>a.node_data.map{|al| 
al.values}) }


Also, next to the default columns from the nodes table, I need an extra 
column computed by a DB function:

Node.select_append(Sequel.function(:collect_member_geometries, :members))


However, I need the extra column and function call together with the 
eager_graph join, but when I try to do this, the extra column seems to get 
lost after the join.

results = Node.where(:name=>name)
  .eager_graph(:node_data)
  .select_append(Sequel.function(:collect_member_geometries, :members))
  .order(:id).all.map { |a| a.values.merge(:node_data=>a.node_data.map{|al| 
al.values}) }


Now the extra column (outcome of collect_member_geometries DB function) is 
not to be found in results.

Does anyone know what I am doing wrong or what I should change to make this 
work?

Many thanks,
Bert Spaan

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to