Class: Project
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Project
- Defined in:
- lib/models/project.rb
Constant Summary collapse
- DEFAULT_NAME =
'default'
- DEFAULT_DESCRIPTION =
'Default Project'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.current_active? ⇒ Boolean
21 22 23 |
# File 'lib/models/project.rb', line 21 def self.current_active? where(:active => true).first end |
.default ⇒ Object
17 18 19 |
# File 'lib/models/project.rb', line 17 def self.default find_or_create_by_active true end |
Instance Method Details
#activate ⇒ Object
25 26 27 28 29 30 |
# File 'lib/models/project.rb', line 25 def activate deactivate_all self.active = true self.save self end |
#deactivate_all ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/models/project.rb', line 32 def deactivate_all Project.all.each do |project| if project.id != self.id project.active = false project.save end end end |