Project

General

Profile

Solved: Registering activity in plugin

Added by Juhani Seppälä over 8 years ago

Greetings,

I'm having issues creating a new activity from a plugin:

ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'projects.id' in 'where clause': SELECT `issue_votes`.* FROM `issue_votes` WHERE
(issue_votes.created_on BETWEEN '2015-07-01' AND '2015-07-31') AND (((projects.id = 3 OR (projects.lft > 1 AND projects.rgt < 2)))
AND (projects.status = 1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_votes')))):
  lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb:81:in `find_events'
acts_as_activity_provider :type => "issue_votes",
                            :scope => preload({:issue => :project}),
                            :timestamp => "#{IssueVote.table_name}.created_on",
                            :author_key => "#{IssueVote.table_name}.user_id",
                            :permission => :vote_issue

Does this suggest a problem with my associations or with the above options I've provided? I've looked into some other plugins for pointers with little luck so far.

Edit: this is on Redmine 3.0.3.stable


Replies (1)

RE: Registering activity in plugin - Added by Juhani Seppälä over 8 years ago

Solved my problem by adding a join with the projects-table to the scope option.

    (1-1/1)