First of all, thanks for the amazing gem! I really love it and it makes all
happy at day job! (qboxmail.com)
I am using Sequel in a rails project, and my model need to get attributes
from 3 others tables outside its main one.
I was wondering what is the best way to design this.
Right know I am keeping really simple and doing something like this on my
model:
def my_extenarn_table_attribut
return @my_external_table_attribute if
!@my_external_table_attribute.nil?
row = DB[:external_table].where(...).first
# Cache also lastname
if row
@my_external_table_attribute = row[:givenname]
else
@my_external_table_attribute = nil
end
return @my_external_table_attribute
end
But as the number of external table to reference increases I feel this
solution is too stupid. Another real problem is when asking a list of this
model, the query get complex and it is repeated for each model in the list.
Ideally I would like to use joins in smart way both when asking a list or a
single result.
Any suggestion on the design?
--
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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.