Sha256: 1a98bd7f42fef3e769318aae96f0bf0508e8ce5eabfe59089b6dd929bd35ec95

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

# frozen_string_literal: true

class StructureObserver < ActiveRecord::Observer
  observe Structure

  def after_create(_record)
    self.class.update_routes
  end

  def after_update(_record)
    self.class.update_routes
  end

  def after_destroy(_record)
    self.class.update_routes
  end

  # Clear all avaiable cache
  def self.update_routes
    Rails.application.reload_routes!
    Rails.cache.clear
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/observers/structure_observer.rb