undefined method `code_name' for nil:NilClass