How to store coordinates hash with object_ids in database?

sadfuzzy Posted by sadfuzzy on November 18, 2012

I have an application on rails 3 with PostgreSQL database.

The problem is: I want to store coordinates with an object_id to access it like:

Post1 -> Coordinates [100,200] -> Attachment1
Post1 -> Coordinates [400,400] -> Attachment2
Post1 -> Coordinates [200,500] -> Attachment3

Post2 -> Coordinates [150,310] -> Attachment1

Post3 -> Coordinates [50,710] -> Attachment1
Post1 -> Coordinates [430,430] -> Attachment2

I'd want to store all the attachments, with coordinates in one place (i.e. Coordinating model) not to make the things messy. Is it possible?

I've never met any way of solving this or similar.

Answers

piyush Answered by piyush on August 26, 2013

Hash.new , push the data in the Hash.

Save the Hash in Db .