Agnieszka Figiel
2005-Sep-06 15:12 UTC
error_messages_for - different controllers, one view [revisited]
Hi there, some time ago there were two posts on this subject on this list: One way that might satisfy the elegence factor is to treat your> comment controller as a component in this case, calling > render_component within your post controller where you need to process > the comment. > > http://manuals.rubyonrails.com/read/chapter/73 > > There are a few ways you could do this with the component feature of > Rails 0.10 without resorting to orphaning actions within controllers > where it just doesn''t feel like they belong. > > Duane Johnson > (canadaduane) > > > On Fri, 11 Mar 2005 13:23:41 -0500, John Baku <john at bakuinc.com <http://lists.rubyonrails.org/mailman/listinfo/rails>> wrote: > >* I have thought of work arounds but I wonder what the prefered way of doing the > *>* following is. > *>* > *>* I have a view in my post controller that displays an entry for my weblog as well > *>* as a form to add a new comment. Whe you submit a new comment it is processed in > *>* the comment controller. If an error occurs I need to take the user back to the > *>* view that is in the post controller though and to do that I can''t use a > *>* render_action but a redirect_to where I loose all my error messages. How would > *>* I go about doing this. > *>* > *>* I have thought of doing the comment processing in the post controller, I have > *>* also though about doing the validation in the post controller and then > *>* processing in comment controller. What do you guys suggest?* > >Please, could you provide some more detailed hints? My situation could probably be handled similarly. I have orders which consist of items, and I want to have a view where you have a form for editing the properties of the order, and below forms for editing its items. I would like to have error_messages_for the order and the items as well. And in case of errors in the items I would like to stay in the same view with the order properties above and item list below. so far I haven''t managed to satisfy all of these conditions whatever approach I take, I would appreciate it if you could be specific about this :-) -- Agnieszka Figiel _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Agnieszka Figiel
2005-Sep-07 08:00 UTC
error_messages_for - different controllers, one view [revisited]
Hi there, some time ago there were two posts on this subject: One way that might satisfy the elegence factor is to treat your> comment controller as a component in this case, calling > render_component within your post controller where you need to process > the comment. > > > http://manuals.rubyonrails.com/read/chapter/73 > > There are a few ways you could do this with the component feature of > Rails 0.10 without resorting to orphaning actions within controllers > > where it just doesn''t feel like they belong. > > Duane Johnson > (canadaduane) > > > On Fri, 11 Mar 2005 13:23:41 -0500, John Baku <john at bakuinc.com > <http://lists.rubyonrails.org/mailman/listinfo/rails>> wrote: > >* I have thought of work arounds but I wonder what the prefered way of doing the > *>* following is. > *>* > *>* I have a view in my post controller that displays an entry for my weblog as well > > *>* as a form to add a new comment. Whe you submit a new comment it is processed in > *>* the comment controller. If an error occurs I need to take the user back to the > *>* view that is in the post controller though and to do that I can''t use a > > *>* render_action but a redirect_to where I loose all my error messages. How would > *>* I go about doing this. > *>* > *>* I have thought of doing the comment processing in the post controller, I have > > *>* also though about doing the validation in the post controller and then > *>* processing in comment controller. What do you guys suggest?* > >Please, could you provide some more detailed hints? My situation could probably be handled similarly. I have orders which consist of items, and I want to have a view where you have a form for editing the properties of the order, and below forms for editing its items. I would like to have error_messages_for the order and the items as well. And in case of errors in the items I would like to stay in the same view with the order properties above and item list below. so far I haven''t managed to satisfy all of these conditions whatever approach I take, I would appreciate it if you could be specific about this :-) -- Agnieszka Figiel _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails