From a191b634c508d224dd0c5417ea63fd105e6178af Mon Sep 17 00:00:00 2001 From: yan Date: Mon, 28 Apr 2014 20:37:12 +0800 Subject: [PATCH] forum memocount error, footer margin --- .gitignore | 2 +- app/models/forum.rb | 2 +- app/views/forums/_show_topics.html.erb | 2 +- app/views/layouts/_base_footer.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index dca762ab6..d53811d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /.project /.idea /.bundle - +*.swp /config/database.yml /files/* /log/* diff --git a/app/models/forum.rb b/app/models/forum.rb index aa7f16cd3..e6b16df39 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -1,7 +1,7 @@ class Forum < ActiveRecord::Base include Redmine::SafeAttributes has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy - has_many :memos, :dependent => :destroy + has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL" belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' safe_attributes 'name', 'description', diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index 3e7d4947b..7f8017897 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,6 +1,6 @@ -
共有 <%=link_to memos.count %> 个贴子
+
共有 <%=link_to @forum.memos.count %> 个贴子
<% if memos.any? %> <% memos.each do |topic| %> diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 0f2334656..5ef65ed72 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -1,7 +1,7 @@