class M2Config::Route
Public Class Methods
elect!( route66 )
click to toggle source
# File lib/m2config/route.rb, line 13 def self.elect!( route66 ) toMatch = {path: route66.path, host_id: route66.host_id} toExclude = {id: route66.id} Route.where(toMatch).exclude(toExclude).delete end
new( fields )
click to toggle source
Calls superclass method
# File lib/m2config/route.rb, line 5 def initialize( fields ) fields[:target_id] = fields[:target].id fields[:target_type] = fields[:target].type fields.delete(:target) super(fields, false) save end
Public Instance Methods
host=( hostOrId )
click to toggle source
# File lib/m2config/route.rb, line 19 def host=( hostOrId ) self.host_id = hostOrId.kind_of?(Host) ? hostOrId.id : hostOrId save end
target()
click to toggle source
# File lib/m2config/route.rb, line 30 def target case target_type when "proxy" then Proxy[target_id] when "dir" then Dir[target_id] when "handler" then Handler[target_id] end end
target=( newTarget )
click to toggle source
# File lib/m2config/route.rb, line 24 def target=( newTarget ) self.target_id = newTarget.id self.target_type = newTarget.type save end