Fully leverage the #wiki_files association on Web

This commit is contained in:
James Herdman 2009-08-30 13:13:12 -04:00
parent 8c1ded2303
commit bea8525130

View file

@ -77,11 +77,11 @@ class Web < ActiveRecord::Base
end end
def has_file?(file_name) def has_file?(file_name)
WikiFile.find_by_file_name(file_name) != nil wiki_files.exists?(:file_name => file_name)
end end
def file_list(sort_order = 'file_name') def file_list(sort_order="file_name")
WikiFile.all(:order => sort_order, :conditions => ['web_id = ?', id]) wiki_files.all(:order => sort_order)
end end
def pages_that_link_to(page_name) def pages_that_link_to(page_name)