module Validators
  class DeployEnv::StackTemplate < Base

    def valid?
      return true unless @model.stack_template

      Devops::Db.connector.stack_templates.detect do |template|
        template.id == @model.stack_template
      end
    end

    def message
      "Invalid stack template '#{@model.stack_template}'."
    end
  end
end
