Skip to content

Adding atoms to a model

Petr Marek edited this page Oct 21, 2020 · 2 revisions

Use the Folio::HasAtoms::Basic concern.

# app/models/my_project/product.rb

class MyProject::Product < ApplicationRecord
  include Folio::HasAtoms::Basic
end

Modify the console controller

Add atoms_strong_params.

# app/controllers/folio/console/my_project/products_controller.rb

module Folio
  class Console::MyProject::ProductsController < Console::BaseController
    ...

    private

      def product_params
        params.require(:my_project_product)
              .permit(:title,
                      :description,
                      *atoms_strong_params)
      end
  end
end