RubyOnRails: Problem representing objects in forms

R

rexlorenzo

Hello,

I am having a huge problem representing objects in my forms with Rails'
FormHelper.

Object setup:

apt_transactions :has_many transaction_participants

Value setup:

apt_transactions has a value of monetary_total
transaction_participants has a value of monetary_share

Problem:

Now, I am trying to have a form in which a user can enter in data in
which they can set the monetary_total and specific how that total is
divided amoung the transaction_participants.

Now, my question is, how can this relationship be represented in a
form?

I am having trouble getting the FormHelper to work:

<%= text_field("apt_transaction_transaction_participants[]",
"monetary_share") %>
produces a NoMethodError exception

I have no clue how this will be represented in a form. For example,
would it appear as:

<input type="text"
name="apt_transactions[transaction_participants][][monetary_share]" >

I have no clue...
 
R

rexlorenzo

Well, I did post on the mailing list and tried subscribing to it, but
it was way too much traffic (even with digest mode on).

Just to simply my question. Suppose an object "foo" has many "bar"
objects.

How would you represent the many "bar" objects, so that you can provide
a form to add/edit them along with the other attributes of "foo"?
 
M

Martin DeMello

Well, I did post on the mailing list and tried subscribing to it, but
it was way too much traffic (even with digest mode on).

I suggest setting digest mode back to off, and creating a gmail account
to subscribe to the list instead. It has a very nice interface and no
space limitation issues, so you can filter the list not to appear in
your inbox, and then just let the mail flood in and only read the ones
you're interested in.

martin
 
A

Austin Ziegler

Well, I did post on the mailing list and tried subscribing to it, but
it was way too much traffic (even with digest mode on).

The problem is that this list is very active as well and many of the
people here are not Ruby on Rails users and cannot answer specific
questions about that software package. If a question is about Ruby in
general, then it's certainly appropriate for ruby-talk; if it's about
habtm or some other *specific* Rails question (or any other package,
really), the question *probably* belongs on the appropriate package
mailing list, if it exists.

-austin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,189
Messages
2,571,015
Members
47,616
Latest member
gijoji4272

Latest Threads

Top