diff options
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r-- | app/models/environment.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index 20da71ccb3f..ff55e751f70 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -21,6 +21,9 @@ class Environment < ActiveRecord::Base delegate :stop_action, to: :last_deployment, allow_nil: true + scope :available, -> { with_state(:available) } + scope :stopped, -> { with_state(:stopped) } + state_machine :state, initial: :available do event :start do transition stopped: :available |