Populate form with object

Hey there,

Im going to as what im sure is a newbie question but from all my googling and trial an error and i cannot seem to figure out how to do this.

Basically im in the process of trying to learn RoR, to do this im building a test app that interacts with the Shopify API ( We use shopify a lot at my work ).

I have the app set up to pull a product and this is saved as an object ( That all works fine ):

product = ShopifyAPI::Product.find( {{ product.id }} )

What im wanting to do is populate a form with the data from this object e.g. title, description etc so that users of the app can edit products from the app, click save and it will update the product within shopify.

The bit im stuck on is actually populating a form the the object data, i know how to call save once the changes have been done, i just cant work out how to actually populate the form.

Im sure this is dead easy but i just cant seem to work it out

Thanks in advance

Start by working right through a good tutorial such as railstutorial.org (which is free to use online), that will show you the basics of rails, including the answer to your question.

Colin

You basically need to load that product from the database and render the edit form. This edit form will have the product instance loaded from the database, Rails will automatically render the form and autofill the fields with values from the product object. Read my free book 7 Step Framework for Coding Skills Acquisition to learn more. I use a simple blog application. The concept is the same.