Sha256: 6f83ff6a78e010a0f563eb3926595fff89d0b1638c7c20c71677ae44381e59bd

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require 'active_fedora'
require 'active_model_serializers'
require_relative './persistence_base_serializer'
module CommonRepositoryModel
  class ObjectNotFoundError < ActiveFedora::ObjectNotFoundError
  end

  class PersistenceBase < ActiveFedora::Base
    include ActiveModel::SerializerSupport
    def active_model_serializer
      "#{self.class}Serializer".constantize
    end

    class_attribute :attributes_for_json
    self.attributes_for_json = []

    def self.register_attribute(attribute_name, options = {})
      delegate(attribute_name, options)
      self.attributes_for_json ||= []
      self.attributes_for_json += [attribute_name]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
common_repository_model-0.0.9 lib/common_repository_model/persistence_base.rb
common_repository_model-0.0.8 lib/common_repository_model/persistence_base.rb
common_repository_model-0.0.7 lib/common_repository_model/persistence_base.rb