Method: Iqvoc::Versioning#branch

Defined in:
lib/iqvoc/versioning.rb

#branch(user) ⇒ Object

********* Methods



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/iqvoc/versioning.rb', line 71

def branch(user)
  new_version = self.dup(:include => self.class.includes_to_deep_cloning)
  new_version.lock_by_user(user.id)
  new_version.increment(:rev)
  new_version.published_version_id = self.id
  new_version.unpublish
  new_version.send(:"#{Iqvoc.change_note_class_name.to_relation_name}").build(
    :language => I18n.locale.to_s,
    :annotations_attributes => [
      { :namespace => "dct", :predicate => "creator", :value => user.name },
      { :namespace => "dct", :predicate => "modified", :value => DateTime.now.to_s }
    ])
  new_version
end