1class Environment < ActiveRecord::Base 2 belongs_to :service 3 has_many :failures 4 before_create :create_api_key 5 6 private 7 8 def create_api_key 9 self.api_key = SecureRandom.uuid 10 end 11end