1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Replaced Board#topics with a regular method.

git-svn-id: http://svn.redmine.org/redmine/trunk@13491 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-10-22 19:40:55 +00:00
parent 116eb8bcc7
commit 94a491e0ca

View File

@ -18,7 +18,6 @@
class Board < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :project
has_many :topics, lambda {where("#{Message.table_name}.parent_id IS NULL").order("#{Message.table_name}.created_on DESC")}, :class_name => 'Message'
has_many :messages, lambda {order("#{Message.table_name}.created_on DESC")}, :dependent => :destroy
belongs_to :last_message, :class_name => 'Message'
acts_as_tree :dependent => :nullify
@ -52,6 +51,11 @@ class Board < ActiveRecord::Base
name
end
# Returns a scope for the board topics (messages without parent)
def topics
messages.where(:parent_id => nil)
end
def valid_parents
@valid_parents ||= project.boards - self_and_descendants
end