Project

General

Profile

« Previous | Next » 

Revision b824778e

Added by Ohad Levy almost 12 years ago

  • ID b824778ec52f6a5506d1ad17d2e6d30bd0f9f1f6

added a scope per proxy feature

View differences:

app/models/smart_proxy.rb
class SmartProxy < ActiveRecord::Base
ProxyFeatures = %w[ TFTP DNS DHCP Puppetca Puppet]
attr_accessible :name, :url
#TODO check if there is a way to look into the tftp_id too
# maybe with a predefined sql
......
before_destroy EnsureNotUsedBy.new(:subnets, :domains, :hosts, :hostgroups)
default_scope :order => 'LOWER(smart_proxies.name)'
ProxyFeatures.each {|f| scope "#{f.downcase}_proxies".to_sym, where(:features => {:name => f}).joins(:features) }
def hostname
# This will always match as it is validated

Also available in: Unified diff