Class: ActiveFedora::Base

Inherits:
Object
  • Object
show all
Extended by:
LdpCache::ClassMethods, Querying, ActiveModel::Naming, ActiveSupport::DescendantsTracker
Includes:
Associations, AttachedFiles, AttributeMethods, Attributes, AutosaveAssociation, Callbacks, Core, FedoraAttributes, Indexing, LoadableFromJson, NestedAttributes, Persistence, Reflection, Scoping, Serialization, Validations, Versionable, ActiveModel::Conversion
Defined in:
lib/active_fedora/base.rb

Overview

This class ties together many of the lower-level modules, and implements something akin to an ActiveRecord-alike interface to fedora. If you want to represent a fedora object in the ruby space, this is the class you want to extend.

The Basics

class Oralhistory < ActiveFedora::Base
   "properties", type: ActiveFedora::SimpleDatastream do |m|
    m.field "narrator",  :string
    m.field "narrator",  :text
  end
end

The above example creates a Fedora object with a metadata datastream named “properties”, which is composed of a narrator and bio field.

Attached files defined with contains are accessed via the attached_files member hash.

Constant Summary

Constant Summary

Constants included from AttributeMethods

AttributeMethods::AttrNames

Constants included from AutosaveAssociation

AutosaveAssociation::ASSOCIATION_TYPES

Constants included from Callbacks

Callbacks::CALLBACKS

Instance Attribute Summary

Attributes included from Associations

#association_cache

Method Summary

Methods included from Querying

default_sort_params, extended

Methods included from LdpCache::ClassMethods

cache, uncached

Methods included from LoadableFromJson

#init_with_json

Methods included from Versionable

#create_version, #has_versions?, #model_type, #restore_version, #versions

Methods included from Attributes

#[], #[]=, #attribute_names, #attributes, #attributes=, #inspect, #local_attributes, #mark_as_changed, #value_has_changed?

Methods included from AttributeMethods

#[], #[]=, #attribute_names, #attributes

Methods included from FedoraAttributes

#id, #id=, #pid, #resource, #set_value, #uri

Methods included from AttachedFiles

#add_datastream, #add_file, #add_file_datastream, #attach_file, #attached_files, #clear_attached_files, #clear_datastreams, #contains_assertions, #datastreams, #ds_specs, #load_attached_files, #metadata_streams, #serialize_attached_files, #undeclared_files

Methods included from Serialization

#serializable_hash

Methods included from NestedAttributes

#_destroy

Methods included from AutosaveAssociation

#changed_for_autosave?, #mark_for_destruction, #marked_for_destruction?, #reload

Methods included from Associations

#association, #clear_association_cache

Methods included from Validations

#required?, #save, #save!, #valid?

Methods included from Callbacks

#destroy

Methods included from Indexing

#indexing_service, #to_solr, #update_index

Methods included from Persistence

#delete, #destroy, #destroyed?, #eradicate, #new_record?, #persisted?, #save, #save!, #update

Methods included from Core

#==, #freeze, #frozen?, #init_with_resource, #initialize, #ldp_source, #readonly!, #readonly?, #reload