# Dynamically adding rows in rails application

**URL:** <https://www.ruby-forum.com/t/dynamically-adding-rows-in-rails-application/104250>\
**Category:** Ruby\
**Created:** [May 15, 2007, 11:06pm UTC](https://www.ruby-forum.com/t/dynamically-adding-rows-in-rails-application/104250 "2007-05-15T23:06:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 15, 2007, 11:06pm UTC](https://www.ruby-forum.com/t/dynamically-adding-rows-in-rails-application/104250/1 "2007-05-15T23:06:53Z")

</div>

Hello all.

I am pretty new to ruby on rails, so please bare with me. I have been  
reading Agile Web D. with Rails and have now decided to  
attempt to create my own application to help me learn rails a bit  
better.

I have a form for user information (name, address, etc.). A user can  
have many courses associated with them. The problem is that all of  
the data needs to be inserted as a transaction at once, and the number  
of courses can vary. I have a form that points to create for the user  
data, but within that form, I need to be able to add a new course line  
to their form. I’d like to get this working without AJAX first to  
make sure I can understand it, but whenever I do a post, it goes to  
create instead of to my ‘add\_course’. When I create a posted link\_to,  
it does not pass the data through for reposting.

My question is: how can I have a link within a form tag pass the post  
data along to a new function, and then show this data back on the form  
after adding another course?

Thank you so much,  
Dave

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 15, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/dynamically-adding-rows-in-rails-application/104250/2 "2007-05-15T23:40:56Z")

</div>

Dave,

This is actually a pure ruby list. You will have far better luck with  
your  
question and future Rails related questions here:

[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk)

I do a little bit with rails. I’m not too sure I follow your question  
but  
the values from your form fields are always sent on in the params hash.  
To  
list all your options you would need a select\_tag with the values from  
the  
table, i.e. Course.find(:all).collect {|course| [course.name, course.id]  
}

Although you will definitely get the help you seek from the rails list.

On 5/15/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the data needs to be inserted as a transaction at once, and the number
> 
> Thank you so much,  
> Dave

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)
