diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 19:40:55 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 19:40:55 +0000 |
commit | 94a491e0ca98246be250fb2a3df4b2f3af39d925 (patch) | |
tree | 22d3663660b572f5d3a1c0b3e48bbb8ee17434c4 /app/models/board.rb | |
parent | 116eb8bcc7a52dab8c7ccc58c08d1c45e45a1fb5 (diff) | |
download | redmine-94a491e0ca98246be250fb2a3df4b2f3af39d925.tar.gz redmine-94a491e0ca98246be250fb2a3df4b2f3af39d925.zip |
Replaced Board#topics with a regular method.
git-svn-id: http://svn.redmine.org/redmine/trunk@13491 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/board.rb')
-rw-r--r-- | app/models/board.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/board.rb b/app/models/board.rb index 9777771a5..7e2507d8b 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -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 |