Closed dcalixto closed 8 years ago
Because Predictor uses Redis as its primary data store to power recommendations/predictions, it only stores exactly what you send it ("product-4", for example). This means we store references to your data, not your entire data object. Instead, a typical subsequent step to using Predictor is to usually use the reference we send you ("product-6") to fetch the actual item from your primary database, which will have your names, images, etc.
So all you need to do is find the item in your primary database that is referenced by "product-6", which typically means a Product.find("product-6")
-like command
i would like to know if i can get the images and links from similarities. for exemple i have a predictor for products @recommender.add_to_matrix!(:products, "impression-1", "product-4")
and on the view
<% ProductRecommender.instance.similarities_for("product-3").each do |item| %> <%= link_to product_path(item) do %> <%= image_tag item.image.url(:thumb).to_s %> <%= item.name%> <% end%> <% end %>
because rails is spitting out undefined method `name' for "product-6":String
thank's