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

finding a page

nirnanaaa edited this page Aug 30, 2013 · 2 revisions

There are several methods to find a page.

I am assuming, that you use Page as the GollumRails::Page subclass and page as an instance of this class.

Find by name

Finding a page by name is very easy:

Page.find('home')

# => #<Page:0x007ff90b784270 @gollum_page=#<Gollum::Page:70353807993320 home (markdown) @wiki="/Users/nirnanaaa/code/test/.git">, @name="home", @content="# ...

Finding by other attributes(currently only name supported)

Find a page by an attribute:

Page.find_by_name('home')
# => #<Page:0x007ff90b784270 @gollum_page=#<Gollum::Page:70353807993320 home (markdown) @wiki="/Users/nirnanaaa/code/test/.git">, @name="home", @content="# ...

Find a page or create it.

Page.find_or_initialize_by_name('home', commit)
# => #<Page:0x007ff90b784270 @gollum_page=#<Gollum::Page:70353807993320 home (markdown) @wiki="/Users/nirnanaaa/code/test/.git">, @name="home", @content="# ...
Clone this wiki locally