Project

General

Profile

Filtering activity scope

Added by Duane Hughes over 11 years ago

Hi all,

I want to pull a limited dataset from the activity page into the front page of my plugin, but I'm not sure how to limit the scope. In other words, I'm trying to only display the activity for events generated by my plugin.

Here's the code I'm trying to get to work, from the plugin controller:

    @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
                                                             :with_subprojects => @with_subprojects)
    @activity.scope = 'kb_articles'

    events = @activity.events(nil, nil, :limit => 10)
    @events_by_day = events.group_by(&:event_date)

However, this yields:

NoMethodError (undefined method `&' for "kb_articles":String):
  lib/redmine/activity/fetcher.rb:59:in `scope='

Can anyone give me an idea of where I'm going wrong?

Many thanks!
Duane Hughes