Skip to content

Using mods_display from non rails app

Naomi Dushay edited this page Feb 2, 2016 · 2 revisions
  1. require 'mods_display' in code
  2. bundle install
  3. you'll want a model something like this:
require 'mods_display'

class ModsDisplayModel
  attr_accessor :modsxml
  include ModsDisplay::ModelExtension
  include ModsDisplay::ControllerExtension
  def initialize mods
    @modsxml = mods
  end
  mods_xml_source do |doc|
    doc.modsxml
  end
end
  1. let's say the MODS xml is in a var called mods_xml:
mm = ModsDisplayModel.new(mods_xml)
  1. now you can access stuff like this:
mm.render_mods_display(mm).imprint

where imprint is one of the mods_display fields: lib/mods_display/fields

Clone this wiki locally