Forgive me if this has been answered, I looked through the archives
and didn't see anything similar to what I was looking for.
The question relates to the handling of has_many and belong_to relationship
between tables. I have created a simple poll and the poll has many poll items.
I can create a scaffold of both of the poll and poll items, but it doesn't make
sense to administer the poll items separately from the polls. I would have to
create a poll item and manually select a poll in which it is associated.
After a poll is created it would be ideal in the show action of the poll controller
to be able to list all the poll items associated with the poll and have the ability
to create, update and delete poll items to that particular poll.
I can create custom methods in the poll class to add all the functionality of what
a poll item scaffold would create, but is there a better way of handling a parent
child relationship so that a you could create children under the parent scaffold?
Thanks,
-Derrick
Thanks everyone,
I was also under the impression that the scaffold wrote all the
code for me and I wasn't doing something correctly. I am
impressed with the ajax scaffold, but for starters, I really
need to understand what the application is really doing.
I've read through most of the Agile Development for Rails and
found it to be very enlightening. At the same time. I've found
a several areas that I would like to understand better, like
migrations and how it helps when writing code instead of
just "it's great for versioning the database".
Rails is very exciting, it's also hard to step in with such a
forward moving language and learn the simple things like
find_all and find_first shouldn't be used. (Thanks Charles!)
I do think (after reading Charles blog) that a
deprectated.rubyonrails.org or a dev.rubyonrails.org/deprecated
would be a great addition. As newbies we could always
check and see if the methods are deprecated and what is
there to replace it, or if you're like me, you would read through
it first just to put it in your mind so you could recognize
deprecated examples when learning and then keep up
to date by reading the release notes.