Sha256: dabc060fcbdaf44be84037159b4322892c2d6b99c458cd62cd534ca5c2ee70e9

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

class Unico::MaterialsController < ::CrudController
  defaults route_prefix: '', resource_class: ::Material

  def new
    object = build_resource
    object.active = true

    super
  end

  def create
    object = build_resource
    MaterialCodeGenerator.new(object).generate!

    super
  end

  protected

  def update_resource(object, attributes)
    object.localized.assign_attributes(*attributes)

    MaterialCodeGenerator.new(object).generate!

    super
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 app/controllers/unico/materials_controller.rb