Project

General

Profile

« Previous | Next » 

Revision ffbb8214

Added by Amos Benari over 11 years ago

  • ID ffbb82142c0c561f6afb495198a70eddd4a1afa1

scope templates by taxonomy.

View differences:

app/models/config_template.rb
class ConfigTemplate < ActiveRecord::Base
include Authorization
include Taxonomix
audited
self.auditing_enabled = !defined?(Rake)
attr_accessible :name, :template, :template_kind_id, :snippet, :template_combinations_attributes, :operatingsystem_ids, :audit_comment
......
has_many :os_default_templates
before_save :check_for_snippet_assoications, :remove_trailing_chars
before_destroy EnsureNotUsedBy.new(:hostgroups, :environments, :os_default_templates)
default_scope :order => 'LOWER(config_templates.name)'
# with proc support, default_scope can no longer be chained
# include all default scoping here
default_scope lambda {
with_taxonomy_scope do
order("LOWER(config_templates.name)")
end
}
scoped_search :on => :name, :complete_value => true, :default_order => true
scoped_search :on => :snippet, :complete_value => true, :complete_value => {:true => true, :false => false}

Also available in: Unified diff