Hello!

We’re using static_cache plugin, and now we have model with this plugin and 
with associations.

But we found that this plugin re-creates instances of models, so 
associations cache doesn’t work.

Example:

class Artist < Sequel::Model
  plugin :static_cache, frozen: false

  one_to_many :albumsend
class Album < Sequel::Model
  many_to_one :artistend
Artist.all.first.albums# SELECT * FROM "albums" WHERE ("albums"."artist_id" = 
1)Artist.all.first.albums# SELECT * FROM "albums" WHERE ("albums"."artist_id" = 
1)

We’re planning use cached model with associations in each, and this fact 
about non-caching associations is sad. :(

Can you change something for associations caching?

Ugly and dangerous work-around is:

class Artist < Sequel::Model
  # ...

  set_dataset dataset.eager(:albums)end
Artist.cache.each_value { |artist| ... }

Thank you.
​

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to