app/repository_models/linked_resource.rb in curate-0.5.1 vs app/repository_models/linked_resource.rb in curate-0.5.2

- old
+ new

@@ -1,27 +1,25 @@ class LinkedResource < ActiveFedora::Base include Hydra::AccessControls::Permissions - include Curate::ActiveModelAdaptor include Sufia::ModelMethods + include CurationConcern::Model + include ActiveFedora::RegisteredAttributes has_file_datastream "content", control_group: 'E' belongs_to :batch, property: :is_part_of, class_name: 'ActiveFedora::Base' has_metadata "descMetadata", type: GenericFileRdfDatastream - delegate_to :descMetadata, [:date_uploaded, :date_modified, :creator], multiple: false + attribute :title, multiple: false, datastream: :descMetadata + has_attributes :date_uploaded, :date_modified, :creator, datastream: :descMetadata, multiple: false - has_metadata 'properties', type: Curate::PropertiesDatastream - delegate_to :properties, [:relative_path, :depositor, :owner], multiple: false - validates :batch, presence: true validates :url, presence: true - class_attribute :human_readable_short_description self.human_readable_short_description = "An arbitrary single file." include ActionView::Helpers::SanitizeHelper - def url= url + def url=(url) u = URI::Parser.new.parse(url) return unless [URI::HTTP, URI::HTTPS, URI::FTP].include?(u.class) content.dsLocation = u.to_s end @@ -31,11 +29,14 @@ def to_s url end - def human_readable_type - self.class.to_s.demodulize.titleize + def to_solr(solr_doc={}, opts={}) + super + Solrizer.set_field(solr_doc, 'url', url, :stored_searchable) + solr_doc end + end