From bea852513021fa166f6a23e022f16450ecd1b512 Mon Sep 17 00:00:00 2001 From: James Herdman Date: Sun, 30 Aug 2009 13:13:12 -0400 Subject: [PATCH] Fully leverage the #wiki_files association on Web --- app/models/web.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/web.rb b/app/models/web.rb index b272826b..e3a9abea 100644 --- a/app/models/web.rb +++ b/app/models/web.rb @@ -77,11 +77,11 @@ class Web < ActiveRecord::Base end def has_file?(file_name) - WikiFile.find_by_file_name(file_name) != nil + wiki_files.exists?(:file_name => file_name) end - def file_list(sort_order = 'file_name') - WikiFile.all(:order => sort_order, :conditions => ['web_id = ?', id]) + def file_list(sort_order="file_name") + wiki_files.all(:order => sort_order) end def pages_that_link_to(page_name)