app/models/media_association.rb
# NOTE: this assumes ancestors have the same published status as their source.
# I _think_ that's safe. (In fact, I believe it's forced in publishing.)
this assumes ancestors have the same published status as their source.
I _think_ that's safe. (In fact, I believe it's forced in publishing.)
this assumes ancestors have the same published status as their source . I _think_ that ' s safe . ( In fact I believe it ' s forced in publishing . )
def build_ancestors(assocs)
      data = Set.new(assocs.values.flatten)
      ids = assocs.keys
      ids.in_groups_of(6400, false) do |group|
        FlatEntry.where(hierarchy_entry_id: group).find_each do |flat_entry|
          assocs[flat_entry.hierarchy_entry_id].each do |row|
            data << row.sub(/^\d+/, flat_entry.ancestor_id.to_s)
          end
        end
      end
      data.to_a
    end
def build_ancestors ( assocs ) data = Set . new ( assocs . values . flatten ) ids = assocs . keys ids . in_groups_of ( 6400 , false ) do | group | FlatEntry . where ( hierarchy_entry_id : group ) . find_each do | flat_entry | assocs [ flat_entry . hierarchy_entry_id ] . each do | row | data << row . sub ( / ^ \d + / , flat_entry . ancestor_id . to_s ) end end end data . to_a end
NOTE: this assumes ancestors have the same published status as their source.
NOTE : this assumes ancestors have the same published status as their source .
assocs
<not_specific>