Forum: Ruby on Rails Populate form with object

0f646d587de53da362c439cd251469bc?d=identicon&s=25 Ben Henry (Guest)
on 2014-08-15 09:06
(Received via mailing list)
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
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-08-15 09:31
(Received via mailing list)
On 14 August 2014 21:58, Ben Henry <ben@squashedpixel.co.uk> wrote:
> 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 
).

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
24f49d448968ea24c8630c31fae12758?d=identicon&s=25 Bala Paranj (Guest)
on 2014-08-18 00:41
(Received via mailing list)
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
www.rubyplus.com/rails.pdf to learn more. I use a simple blog
application.
The concept is the same.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.