将事件添加到redmine活动选项卡

时间:2011-09-06 13:57:15

标签: ruby-on-rails redmine

我有来自redmine-wiki-extensions插件的以下模型。我想使用acts_as_activity_provider添加有关将Wiki页面评论到活动选项卡的通知。

class WikiExtensionsComment < ActiveRecord::Base
  belongs_to :user
  validates_presence_of :comment, :wiki_page_id, :user_id

  acts_as_event :title => Proc.new {|o| "fsda"},
            :description => :comment,
            :datetime => :created_at,
            :author => nil,
            :url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id    => o.wiki.project, :id => o.title}}

  acts_as_activity_provider :timestamp => 'created_at',
                        :author_key => :user_id#, 
                        #:find_options => {:joins => "LEFT JOIN #{Project.table_name} ON   #{Project.table_name}.id = #{RedmineWikiExtensionsComment.table_name}.project_id" }
                        #:find_options => { :include => [:user] }

  def children(comments)
    comments.select{|comment| comment.parent_id == id}
  end
end

但是当我尝试打开我的活动页面时,会导致以下错误:

ActiveRecord::StatementInvalid (PGError: ERROR:  missing FROM-clause entry for table  "projects"
LINE 1: ...d_at BETWEEN '2011-08-08' AND '2011-09-07') AND ((projects.i...
                                                         ^
: SELECT * FROM "wiki_extensions_comments" WHERE (1=1 AND (created_at BETWEEN '2011-08-     08' AND '2011-09-07') AND ((projects.id = 2 OR (projects.lft > 29 AND projects.rgt < 30))   AND (projects.status=1))) ):

我该如何解决?

提前致谢。

0 个答案:

没有答案