title: Rails Postgres hstore or jsonb to store many to many relations
body: <p>There is a table 'Products' with columns (id, tile, price, description, shop_id, timestamps)
  Column price and shop_id are dynamic. The rest of column are static.</p>
  
  <p>Also there is a table 'Shops' with columns (id, name, timestamps).</p>
  
  <p>Shop has many products. Product can migrate among all shops and products.shop_id can be blank.</p>
  
  <p>I want to have history about which products a shop had. For example, yesterday shop had products and their prices. Day before yesterday shop had other products and/or other their prices. So I want to have something like</p>
  
  <p>'ShopHistory' (id, data, date, timestamps), where data is hstore or json. So it should have hash like { key: value}, where key is id of product and value is its current price. But I would like to joins data column with products in order to know about title and description of products. I have no idea how to do that.
  It looks like ShopHistory is a join table between shop and products, but all information are stored in one row.</p>
  
  <p>Could we help me? Maybe anyone knows a better way to implement all of this. Any thought and articles are welcome.</p>
  
  <p>Thanks!</p>
  
  <p>P.S. I use rails(ActiveRecord) and PostgreSQL, but answers from guys who know only Postgres are good for me too.</p>