On Wednesday, January 7, 2015 9:04:40 PM UTC-8, Dennis D wrote:
>
> I'm trying to create a custom association where I have compound primary 
> keys, my association looks like this
>
>
>
>     one_to_many :desired_values,
>                 :key         => [:check_id, :computer_id],
>                 :primary_key => [:check_id, :computer_id],
>                 :order       => [:human_name, :name],
>                 :reportable  => true,
>                 :class_name  => "SCM::ReportDesiredValue",
>                 :dataset => proc {|r|
>                   r.associated_dataset.join(:scm__check_results, :check_id 
> => :check_id) do |j, lj, js|
>                     Sequel.|(:computer_id.qualify(j) => 
> :computer_id.qualify(lj), :computer_id.qualify(lj) => nil)
>

Sequel.| is for taking multiple arguments and ORing them.  As you are only 
passing a single argument, Sequel.| is basically a no-op (it returns the 
argument).

You want Sequel.or, which takes a single hash or array of pairs argument 
and uses OR instead of AND to join the members.

Thanks,
Jeremy

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to