Sha256: a53943739b978cd139a3abfddab67863da94acd98180c0c8895c70afbbb24ba1
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
require_relative './persistence_base' require_relative './collection' module CommonRepositoryModel class Area < PersistenceBase has_many( :collections, class_name: 'CommonRepositoryModel::Collection', property: :is_member_of_area ) has_metadata(name: "properties",type: ActiveFedora::SimpleDatastream) do |m| m.field 'name', :string end validates :name, presence: true delegate_to 'properties', [:name], unique: true def self.find_by_name(name) find({'name_s' => name}).first end def self.find_by_name!(name) find_by_name(name) || raise( CommonRepositoryModel::ObjectNotFoundError.new( "#{self} with name: #{name.to_s} not found" ) ) end # We shouldn't be calling these protected :save, :save! end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
common_repository_model-0.0.6 | lib/common_repository_model/area.rb |