Hi, 

In a many_to_many relationship, is it possible to cache retrieved record 
such that we get the 'reciprocal', e.g.

author = Author.where{:name=>"Einstein"}.first
book = author.books.first

written_by = book.authors.find{|a| a.name == "Einstein"}

assert_equal author, written_by

assuming that author.name is a unique key and based on the following models

class Author < Sequel::Model
  one_to_many :authorships
  many_to_many :books, :join_table=>:authorshipsend
class Authorship < Sequel::Model
  many_to_one :author
  many_to_one :bookend

thanks
Roy

-- 
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