Class: Drupal::Node
- Inherits:
-
Object
- Object
- Drupal::Node
- Defined in:
- lib/drupal/node.rb
Instance Method Summary collapse
- #assign_vid ⇒ Object
- #find_or_init_node_revision ⇒ Object
- #node_revision ⇒ Object
- #write_node_revision ⇒ Object
Instance Method Details
#assign_vid ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/drupal/node.rb', line 15 def assign_vid return true unless vid.nil? self.vid ||= Drupal::Node.all.last.nid + 1 save! self.vid = nid save! end |
#find_or_init_node_revision ⇒ Object
36 37 38 39 |
# File 'lib/drupal/node.rb', line 36 def find_or_init_node_revision return node_revision if node_revision @node_revision = Drupal::NodeRevision.new end |
#node_revision ⇒ Object
41 42 43 |
# File 'lib/drupal/node.rb', line 41 def node_revision @node_revision ||= Drupal::NodeRevision.get vid end |
#write_node_revision ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/drupal/node.rb', line 23 def write_node_revision find_or_init_node_revision.attributes = { :nid => nid, :vid => vid, :uid => uid, :title => title, :body => '', :teaser => '', :log => '' } node_revision.save! end |