From ab63a21ccd234c76ab7778bad053ce1fa4437b4c Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Mon, 15 Oct 2007 19:12:36 +0000 Subject: [PATCH] Fix Rails 1.2.5 deprecation warnings. --- app/models/page.rb | 2 +- lib/page_renderer.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/page.rb b/app/models/page.rb index c5f48d43..9861c6e9 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -25,7 +25,7 @@ class Page < ActiveRecord::Base if (revisions_size > 0) && continous_revision?(time, author) current_revision.update_attributes(:content => content, :revised_at => time) else - revisions.create(:content => content, :author => author, :revised_at => time) + revisions.build(:content => content, :author => author, :revised_at => time) end save self diff --git a/lib/page_renderer.rb b/lib/page_renderer.rb index af64602c..2e3e5a64 100644 --- a/lib/page_renderer.rb +++ b/lib/page_renderer.rb @@ -116,19 +116,19 @@ class PageRenderer else link_type = WikiReference.link_type(@revision.page.web, referenced_name) end - references.create :referenced_name => referenced_name, :link_type => link_type + references.build :referenced_name => referenced_name, :link_type => link_type end include_chunks = rendering_result.find_chunks(Include) includes = include_chunks.map { |c| ( c.escaped? ? nil : c.page_name ) }.compact.uniq includes.each do |included_page_name| - references.create :referenced_name => included_page_name, + references.build :referenced_name => included_page_name, :link_type => WikiReference::INCLUDED_PAGE end categories = rendering_result.find_chunks(Category).map { |cat| cat.list }.flatten categories.each do |category| - references.create :referenced_name => category, :link_type => WikiReference::CATEGORY + references.build :referenced_name => category, :link_type => WikiReference::CATEGORY end end end