Closed jywarren closed 11 years ago
Specifically affecting the lists on the left side under "related wikis" etc. The title displays fine on its own page.
SELECT * FROM node WHERE title LIKE `%barnraising%';
...
| 7223 | 14933 | page | | Barnraising Planning | 1 | 1 | 1367601636 | 1373458261 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 8805 | 15002 | page | | barnraising-2013 | 1 | 1 | 1373458161 | 1373621124 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 8806 | 14935 | page | | barnraising-2012 | 1 | 1 | 1373458584 | 1373458665 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 8807 | 14937 | page | | Barnraising 2011 | 1 | 1 | 1373458721 | 1373458721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
...
SELECT nid, vid, uid, title FROM node_revisions WHERE nid = 8806;
| 8806 | 14934 | 1 | barnraising-2012 |
| 8806 | 14935 | 1 | Barnraising 2012 |
Sidebar appears to use node.title
, but node_revisions.title
has the more accurate data.
Why does node.title
exist if it is redundant and also not useful?
Tossed this into models/drupal_node.rb
def current_revision
# Grab the most recent revision for this node.
DrupalNodeRevision.where(nid: nid).order(:timestamp).limit(1)
end
def current_title
# Grab the title from the most recent revision for this node.
current_revision.title
end
Changed views/sidebar/_related.html.rb to make use of current_title instead of title.
Brrrp wrong answer. "undefined method `title' for #ActiveRecord::Relation:0xc8f4074"
Not sure what is missing. Probably something simple, but I haven't used ActiveRecord in a bit.
Super, my understanding is that node.title
is the default title, and that node_revisions.title
supercedes that system in Drupal if you install the "revisions" module. Another inefficiency due to the modularity of Drupal, though it makes sense.
example: http://publiclab.org/wiki/barnraising-2013 is listed as 'barnraising-2013' but title is "Barnraising 2013".