Actions
Feature #2122
closedCannot Search reports on environment name
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Search
Target version:
-
Description
Being able to search / filter the reports per environment would be very useful.
Tried adding simple scoped_search :in => host, :on => :environment but didn't work. Need an :ext_method for it to work?
Ie, want to be able to search on "host.environment = envname" or short: "environment = envname".
Updated by Ohad Levy over 11 years ago
how about
diff --git a/app/models/report.rb b/app/models/report.rb index f7b0c59..149467f 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -5,10 +5,12 @@ class Report < ActiveRecord::Base has_many :messages, :through => :logs has_many :sources, :through => :logs has_many :logs, :dependent => :destroy + has_one :environment, :through => :host validates_presence_of :host_id, :reported_at, :status validates_uniqueness_of :reported_at, :scope => :host_id scoped_search :in => :host, :on => :name, :complete_value => true, :rename => :host + scoped_search :in => :environment, :on => :name, :complete_value => true, :rename => :environment scoped_search :in => :messages, :on => :value, :rename => :log scoped_search :in => :sources, :on => :value, :rename => :resource
Updated by Mikael Fridh over 11 years ago
Ohad Levy wrote:
how about
[...]
ok, that makes total sense now when I see it.
Updated by Mikael Fridh over 11 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset c85e5e3b24ab82416d49cb569452c617229a2b96.
Actions