Fixed All Pages with a category

This commit is contained in:
Alexey Verkhovsky 2005-11-14 11:07:14 +00:00
parent 614a48c6ff
commit a2cb920489
2 changed files with 3 additions and 2 deletions

View file

@ -337,7 +337,8 @@ class WikiController < ApplicationController
@category = @params['category']
if @category
@set_name = "category '#{@category}'"
@pages_in_category = WikiReference.pages_in_category(@category).map { |page_name| @web.page(page_name) }.by_name
pages = WikiReference.pages_in_category(@category).sort.map { |page_name| @web.page(page_name) }
@pages_in_category = PageSet.new(@web, pages)
else
# no category specified, return all pages of the web
@pages_in_category = @web.select_all.by_name

View file

@ -42,7 +42,7 @@ class WikiReference < ActiveRecord::Base
query =
'SELECT name FROM pages JOIN wiki_references ON pages.id = wiki_references.page_id ' +
'WHERE wiki_references.referenced_name = ? ' +
"AND wiki_references.link_type = '#{CATEGORY}'" +
"AND wiki_references.link_type = '#{CATEGORY}'"
names = connection.select_all(sanitize_sql([query, category])).map { |row| row['name'] }
end