I want to know the standard/easiest way to add items to a parent?
Example: comment added to post
I would like this to happen in the â??showâ?? view of post using a form that
is shown when the user clicks the â??add newâ?? button/link. I would also
like validation on the child form with the validation errors appearing
in the post showâ?? view.
Two problems are presented:
-
When the user clicks the add new button, the form needs to appear.
This suggests that it is in the page when it is loaded and is simply
shown when the â??add newâ?? link is clicked. When the error message(s)
appear on the page, the â??showâ?? view will be refreshed and the form wonâ??t
be shown â?? how to avoid this? -
How to deal with the error messages and the problem of nil.errors or
validation and errors in general. How do I get them to display in the
post â??showâ?? view when validation fails and not get the nil.errors
problem when the post is simply being viewed?
The â??showâ?? view allows the adding of comments with validation and the
validation errors and shown in the â??showâ?? view of the post page.
I am stumped. Completely stumped. I have tried a few methods to get this
working and do not want to post any code since none of them worked and
want to know the best/easiest/common/preferred/actual (take your pick)
method of doing this.
It seems like such an easy thing to do, but I just cannot get this to
work. How would you suggest doing this?