require 'patch_version_like_methods' class PatchVersion < ActiveRecord::Base belongs_to :patch validates_presence_of :for_upstream_version after_save :save_patch_text # "after" because of the id after_destroy :remove_patch_file include PatchVersionLikeMethods @patch_dir = PATCH_REPOSITORY + case ENV['RAILS_ENV'] when 'production' '' else File.join('', ENV['RAILS_ENV']) end class <