MattB wrote: > Hi guys, > > Given a page that retrieves data from a 3rd party API, how would you > then go about associating additional info in the application's > database with that record? > > Specifically, the page displays info on a product, and I'd like to > store and display locally created reviews for that product. > > To display the product I'm using a route of the form /product/ > <productid> where the productid is the barcode of the product. The > barcode is used in the controller to look up the data via the 3rd > party API. > > It's the structure of the database / model and how to link one the > other that I'm struggling with conceptually. (I'm a relatively newbie > with Rails, Ruby & ActiveRecord, and programming in general (!) so > please forgive me if this is painfully obvious!) > > Many thanks in advance for any advice or suggestions... > > Matt.
Seems like you've answered your own question. I'd keep it simple. Make the barcode value a uniquely-indexed attribute of your own product record (with it's id field). Use the id field for all your rails coding - the product record and parent id of the child review records, and use the barcode value to access the external 3rd party API data. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.