In your initilizers/predictor.rb
you shall define your recommender not as:
recommender = CourseRecommender.new
but as:
Recommender = CourseRecommender.new
this way you define a constant throughout the scope of your application, instead of defining a local variable. In your initializer and controller you access it as Recommender
.