Class: Client
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Client
- Defined in:
- lib/models/client.rb
Constant Summary collapse
- DEFAULT_NAME =
'default'
- DEFAULT_DESCRIPTION =
'Default Client'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.current_active? ⇒ Boolean
17 18 19 |
# File 'lib/models/client.rb', line 17 def self.current_active? where(:active => true).first end |
.default ⇒ Object
13 14 15 |
# File 'lib/models/client.rb', line 13 def self.default first_or_create :active => true end |
Instance Method Details
#activate ⇒ Object
21 22 23 24 25 26 |
# File 'lib/models/client.rb', line 21 def activate deactivate_all self.active = true self.save self end |
#deactivate_all ⇒ Object
28 29 30 31 32 33 |
# File 'lib/models/client.rb', line 28 def deactivate_all Client.all.each do |client| client.active = false client.save end end |