Module: Recommender::Recommendation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/recommender/recommendation.rb
Defined Under Namespace
Modules: ClassMethods Classes: AssociationMetadata
Instance Method Summary collapse
Instance Method Details
#recommendations(results: 10) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/recommender/recommendation.rb', line 56 def recommendations(results: 10) other_instances = self.class.where.not(id: id) self_items = associated_items.to_set item_recommendations = calculate_recommendations(other_instances, self_items) sorted_recommendation_ids = sort_recommendations(item_recommendations).take(results) fetch_recommendation_objects(sorted_recommendation_ids, item_recommendations) end |