E
Edgardo Hames
This weekend, I have a written my first Rails application to handle
technical reports at school. The model is very simple, and the only
part I don't know how to deal with is the association between authors
and reports.
Right now, the edit view for the reports has a table with all the
authors in the database and a checkbox for each one of them. If the
list of authors grows too big, this part is going to be a bit too
rough and unusable. How can I handle this "The Rails Way"?
I thought a very neat solution would be to use an input field like the
ones GMail has for the address book. Is that difficult to implement
using Rails and Ajax? Any ideas on how to do that? Are any ActionView
helpers available to do this? How can I dinamically add more input
fields (pushing an "add author" button)?
In case this solution is way too far from being done, how can I handle
checking and unchecking the different authors in that table on the
Controller side? What I would need to do is remove the unchecked
authors and add the checked ones. This involves iterating over the
collection of authors and checkboxes and compare the previous values
with the current ones (which may render the code a little bit
complicated). How do you all usually solve this problem? Is there any
solution for this available in Ruby?
Thanks to everyone,
Ed
--
Encontrá a "Tu psicópata favorito" http://tuxmaniac.blogspot.com
"Tener una amiga en Ginebra es como tener quinotos en almibar o uvas en ron."
"Programming is like sex... make one mistake, and support it the rest
of your life."
"Defeat is an accomplishment not even the best of us could achieve."
technical reports at school. The model is very simple, and the only
part I don't know how to deal with is the association between authors
and reports.
Right now, the edit view for the reports has a table with all the
authors in the database and a checkbox for each one of them. If the
list of authors grows too big, this part is going to be a bit too
rough and unusable. How can I handle this "The Rails Way"?
I thought a very neat solution would be to use an input field like the
ones GMail has for the address book. Is that difficult to implement
using Rails and Ajax? Any ideas on how to do that? Are any ActionView
helpers available to do this? How can I dinamically add more input
fields (pushing an "add author" button)?
In case this solution is way too far from being done, how can I handle
checking and unchecking the different authors in that table on the
Controller side? What I would need to do is remove the unchecked
authors and add the checked ones. This involves iterating over the
collection of authors and checkboxes and compare the previous values
with the current ones (which may render the code a little bit
complicated). How do you all usually solve this problem? Is there any
solution for this available in Ruby?
Thanks to everyone,
Ed
--
Encontrá a "Tu psicópata favorito" http://tuxmaniac.blogspot.com
"Tener una amiga en Ginebra es como tener quinotos en almibar o uvas en ron."
"Programming is like sex... make one mistake, and support it the rest
of your life."
"Defeat is an accomplishment not even the best of us could achieve."