Fix undefined local variable or method `repository'