Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageruby
linenumberstrue
Permalink.on_generate do |obj,url_for_obj|
  if obj.is_a? MediaObject
    return "http://permalinkresolver.example.edu/media/#{obj.pid}"
  else
    return nil
  end
end

 

It's also possible to use a generic route for permalinks.  The pid for an object can be substituted into the object controller route (i.e. /object/avalon:1).  The controller will redirect the browser to the resource.

Code Block
languageruby
linenumberstrue
Permalink.on_generate do |obj,url_for_obj|
  if obj.is_a? MediaObject
    return "http://permalinkresolver.example.edu/object/#{obj.pid}"
  else
    return nil
  end
end