module ArDocStore::EmbeddableModel
Public Class Methods
included(mod)
click to toggle source
# File lib/ar_doc_store/embeddable_model.rb, line 7 def self.included(mod) mod.send :include, ActiveModel::Model mod.send :include, ActiveModel::Attributes mod.send :include, ActiveModel::AttributeMethods mod.send :include, ActiveModel::Dirty mod.send :include, ActiveModel::Serialization mod.send :include, ArDocStore::Storage mod.send :include, ArDocStore::Embedding mod.send :include, ActiveSupport::Callbacks mod.send :include, InstanceMethods mod.send :extend, ClassMethods mod.class_eval do define_callbacks :persist attr_accessor :_destroy attr_accessor :parent attr_accessor :embedded_as # class_attribute :json_attributes # self.json_attributes = HashWithIndifferentAccess.new json_attribute :id, :string #, default: -> { SecureRandom.uuid } set_callback :persist, :before, :ensure_id set_callback :persist, :after, :mark_embeds_as_persisted end end