Class: GollumRails::Page
- Inherits:
-
Object
- Object
- GollumRails::Page
- Extended by:
- ActiveModel::Callbacks, ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Model, ActiveModel::Validations, Callbacks, Core, Error, Finders, Meta, Persistance, Store, Validation
- Defined in:
- lib/gollum_rails/page.rb
Overview
GollumRails
Gollum Rails was initially designed to integrate the Gollum wiki software into your Rails application without any mounts or extra applications to run.
Now you can use your completely own layout without struggling with gollum forks.
Just integrate this gem into your Gemfile and you are good to go:
gem install gollum_rails
or in your Gemfile:
gem 'gollum_rails'
If you want to use this gem with Rails version prior 4.0.0 please check out the rails3 branch on Github:
github.com/nirnanaaa/gollum_rails/tree/rails3
Initialization
To make full use of GollumRails you need to enable it in an initializer by genating it:
rails g gollum_rails:install
Now you can add the path to your Repository in there.
Also you need to set the startup
boolean to true
.
Page model
You also need a model à la ActiveRecord by calling:
rails g gollum_rails:model Page
Creation of a Page
Each action in a Git repository needs a Commit, which identifies the author!
commit = { name: 'nirnanaa', email: '[email protected]', message: 'created page page'}
Page.create(name: 'test_page', content: 'content', format: :markdown, commit: commit)
Page.create!(name: 'test_page', content: 'content', format: :markdown, commit: commit)
The !
version of the method throws an error on failure.
page = Page.new(name: 'test_page', content: 'content', format: :markdown, commit: commit)
page.save
# OR
page.save!
Constant Summary
Constants included from Callbacks
Constants included from Store
Store::ATTR_ACCESSORS, Store::ATTR_READERS, Store::ATTR_WRITERS
Method Summary
Methods included from Callbacks
Methods included from Persistance
#create_or_update, #create_record, #delete, #destroy, #persisted?, #save, #save!, #update_attributes, #update_deprecated, #update_record
Methods included from Store
#content, #filename, #format, #name, #page
Methods included from Meta
#has_yaml?, #html_without_yaml, #meta, #meta_title, #raw_meta
Methods included from Core
#canonicalized_filename, #compare_commits, #current_version, #history, #html_data, #initialize, #last_changed_by, #path_name, #preview, #raw_data, #sub_page?, #title, #url