diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-08-31 04:07:15 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-08-31 04:07:15 +0000 |
commit | 73df51454bf561025d1994ec9b9a0ad5fc5b7901 (patch) | |
tree | 604a14b3e8598c21571d5a4cd1633f95ed6536fb /app/models | |
parent | 8a8f5782ec55deb5716411f0e2c19117738cacbe (diff) | |
download | redmine-73df51454bf561025d1994ec9b9a0ad5fc5b7901.tar.gz redmine-73df51454bf561025d1994ec9b9a0ad5fc5b7901.zip |
Rails3: replace deprecated 'validate' method at WikiPage model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6834 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/wiki_page.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index f937b8d67..4c2c7adb9 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -42,6 +42,8 @@ class WikiPage < ActiveRecord::Base validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false validates_associated :content + validate :validate_parent_title + # eager load information about last updates, without loading text named_scope :with_updated_on, { :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", @@ -161,7 +163,7 @@ class WikiPage < ActiveRecord::Base protected - def validate + def validate_parent_title errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) errors.add(:parent_title, :not_same_project) if parent && (parent.wiki_id != wiki_id) |