Module: Pageflow::RevisionComponent::ClassMethods

Defined in:
lib/pageflow/revision_component.rb

Instance Method Summary collapse

Instance Method Details

#all_for_revision(revision) ⇒ Object


26
27
28
# File 'lib/pageflow/revision_component.rb', line 26

def all_for_revision(revision)
  where(revision_id: revision.id)
end

#from_perma_ids(revision, perma_ids) ⇒ Object


30
31
32
33
34
35
36
# File 'lib/pageflow/revision_component.rb', line 30

def from_perma_ids(revision, perma_ids)
  return [] if revision.blank? || perma_ids.blank?

  perma_ids.map do |perma_id|
    find_by_revision_id_and_perma_id(revision.id, perma_id)
  end.compact
end