Avoid setting page as parent id, which has current page as parent.
This commit is contained in:
parent
20b7db306b
commit
6c82d0e06a
3 changed files with 14 additions and 6 deletions
|
|
@ -32,11 +32,15 @@ class Page < ActiveRecord::Base
|
|||
|
||||
named_scope :non_redirected, :conditions => {:redirect => nil}
|
||||
named_scope :no_parent, :conditions => {:parent_id => nil}
|
||||
|
||||
|
||||
def self.permalink(title)
|
||||
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
||||
end
|
||||
|
||||
def homepage?
|
||||
permalink == "Home"
|
||||
end
|
||||
|
||||
def set_permalink
|
||||
unless title.blank?
|
||||
self.permalink = Page.count == 0 ? "Home" : Page.permalink(title)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue