Skip to content

Migrating code to JSON data based atoms

Petr Marek edited this page Aug 8, 2019 · 4 revisions
  • Replace atom.data with atom in cell tests.
  • Replace :redactor with :richtext in STRUCTURE definitions
  • Move attachments keys (cover/images/document/documents) to a new ATTACHMENTS constant
  • Move model key to a new ASSOCIATIONS constant
# before
STRUCTURE = {
  cover: true,
  title: :string,
  content: :redactor,
  model: %w[Folio::Page]
}

becomes

# after
ATTACHMENTS = %i[
  cover
]

STRUCTURE = {
  title: :string,
  content: :richtext,
}

ASSOCIATIONS = {
  model: %w[Folio::Page],
}