Method: ActiveFedora::Core#init_with_resource

Defined in:
lib/active_fedora/core.rb

#init_with_resource(rdf_resource) ⇒ Object

Initialize an empty model object and set its resource example:

class Post < ActiveFedora::Base
end

post = Post.allocate
post.init_with_resource(Ldp::Resource.new('http://example.com/post/1'))
post.title # => 'hello world'


77
78
79
80
81
82
83
84
# File 'lib/active_fedora/core.rb', line 77

def init_with_resource(rdf_resource)
  init_internals
  @ldp_source = rdf_resource
  load_attached_files
  run_callbacks :find
  run_callbacks :initialize
  self
end