Sha256: 7034c19afbcb34e7001d30cc6410fef4a680e6ef623c82daf54a36a0b552cc25
Contents?: true
Size: 756 Bytes
Versions: 1
Compression:
Stored size: 756 Bytes
Contents
require "yaml" module ActiveAdminVersioning module Extension module PaperTrail def item_class item_type.safe_constantize end def item_class_i18n item_class.try(:model_name).try(:human) || item_type end def item_column_names item_class.column_names end def item_attributes YAML.load(object).slice(*item_column_names) rescue nil end def item_instance @item_instance ||= item_buildable? ? item_class.new(item_attributes) : nil end def event_i18n I18n.t("views.version.event.#{event}", default: event) end private def item_buildable? item_class && item_attributes end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_admin_versioning-0.1.0 | lib/active_admin_versioning/extension/paper_trail.rb |