First steps for an own wiki.
* Scaffold for Page Objekt * Using textile for rendering html * Easy wiki-links with [[wikipage]]
This commit is contained in:
parent
37199bae1d
commit
f450070dbf
16 changed files with 252 additions and 1 deletions
12
app/models/page.rb
Normal file
12
app/models/page.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class Page < ActiveRecord::Base
|
||||
|
||||
validates_presence_of :title, :body
|
||||
|
||||
before_save :set_permalink
|
||||
|
||||
def set_permalink
|
||||
if self.permalink.blank? #FIXME: or title.changed?
|
||||
self.permalink = Page.count == 0 ? "home" : "#{title.downcase.strip.gsub(/ |\.|@/, '-')}"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue