Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

history

nirnanaaa edited this page Aug 30, 2013 · 2 revisions

Displaying the History of a page

This method will return an Array of commits.

page = Page.find('home')

page.history
# => [#<Grit::Commit "5ae3fc1100041c149cb2186edfbbc31960daf982">, #<Grit::Commit "76326d4fb106bf03dbb828986f3527cc34f96a01">, #<Grit::Commit "681aae44e773dfe8802c4cf57006873886bd347c">, #<Grit::Commit "0f16572ac18fc7cdc99f1ed2e0698bf53501d766">, #<Grit::Commit "b64d34e0bd159e2e209aaa5cb7cccac003f37994">]

Display the Author of a specific commit

This method will return an instance of Grit::Actor.

You can use .to_s to get the authors name as a String.

page = Page.find('home')

page.history.last.author
# => #<Grit::Actor "Mosny <mosny@zyg.li>">

page.history.last.author.to_s
# => "Mosny"
Clone this wiki locally