Class: Goldencobra::Domain

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/goldencobra/domain.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.currentObject



29
30
31
# File 'app/models/goldencobra/domain.rb', line 29

def self.current
	Thread.current[:current_client]
end

.current=(ccl) ⇒ Object



33
34
35
# File 'app/models/goldencobra/domain.rb', line 33

def self.current=(ccl)
	Thread.current[:current_client] = ccl
end

.mainObject



16
17
18
# File 'app/models/goldencobra/domain.rb', line 16

def self.main
  Goldencobra::Domain.where(main: true).first
end

Instance Method Details

#mark_as_mainObject



20
21
22
23
24
25
26
27
# File 'app/models/goldencobra/domain.rb', line 20

def mark_as_main
  if self.main == true
    Goldencobra::Domain.where("id <> #{self.id.to_i}").each do |a|
      a.main = false
      a.save
    end
  end
end