Commit 3e763252 authored by jplang's avatar jplang

Replaced Board#topics with a regular method.

git-svn-id: e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e7f5ec79
......@@ -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
# Returns a scope for the board topics (messages without parent)
def topics
messages.where(:parent_id => nil)
def valid_parents
@valid_parents ||= project.boards - self_and_descendants
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment