Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @people = Person.where(conditions).includes(eager_fetch).all
- @people = Person.where(conditions).all
- @fragments = {}
- @people.dup.each do |person|
- cache_key = "fragment-for-#{person.id}-#{person.updated_at.to_i}"
- fragment = Rails.cache.fetch(cache_key)
- unless fragment.nil?
- @fragments[person.id] = fragment
- @people.delete person
- end
- end
- @people = Person.where(:id => @people.collect(&:id)).includes(eager_fetch).all
- Person.send :preload_associations, @people, eager_fetch
Add Comment
Please, Sign In to add comment