Question on insert to multiple tables?

Hello, every day i love more rails xD because after struggling a bit I
could finally install the Active Scaffold plugin and it works great with
this.

But now it is time to grow a little more on rails and am trying to make
an ordering system and products. Which on my system I have these 3
tables:

Product:
=> id_product
=> name
=> amount
=> prices

Request:
=> id_order
=> date_order
=> recipient
=> address

Detalles_pedido:
=> product_id
=> order_id
=> price_unity
=> amount
=> total

So you see, the Active Scaffold allows me to work on each table CRUD
apart, but now I need to create a form based on which prodcuts can
submit all of my store and that the user choose the amount of each and
then add address of the recipient and the date of order, fields that are
in the order table. But while I have to insert in "ORDER_DETAIL
'respective ids and the amount and the respective total for the order.

And since I have been finding out something about a method @ task = @
project.tasks.build (params [: task]) but does not help much, because
maybe you need now is an array to insert in “ORDER_DETAIL” and that it
could be done in php but not much beyond that domain and, lo conosco no
rails at all.

If rails is not an easier way to do this or if I can do all this with
the Active Scaffold, as I see all these respects the relationship and
insertions in different tables at once.

The truth’m a bit lost and I hope they can give me a hand that cat xD no
idea where to start now!

You are probably better of posting on the activescaffold group:

http://groups.google.com/group/activescaffold

Unfortunately their documentation site is down at the moment but I’m
pretty sure they describe how to do model associations in
activescaffold.

http://activescaffold.com/docs

To be honest if you are a beginner I wouldn’t recommend starting out on
activescaffold - get the Agile Web D. with Rails book and learn
the fundamentals first:

http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition

Cheers
Luke

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs