samedi 21 janvier 2017

Rails predictor array_to_json

I'm, trying to create a prediction of product using predictor gem and ip_address but rails spits out

no such function: array_agg

someone have any idea what this array_agg mean? thank's

gem link http://ift.tt/KeiJUV

ActiveRecord::StatementInvalid: SQLite3::SQLException: no such function: array_agg: SELECT ip_address, array_to_json(array_agg(product_id)) as product_ids FROM impressions GROUP BY ip_address

 impressions_data = Impression.connection.execute('SELECT ip_address, array_to_json(array_agg(product_id)) as product_ids FROM impressions GROUP BY ip_address')
    impressions_data.each { |row| recommender.impressions.add_to_set(row['ip_address'], eval(row['product_ids'])) }

Aucun commentaire:

Enregistrer un commentaire