I’ve been away from Rails for a long time but just recently got back to one of my old project; The Daily Deal App.
Part of this is of course creating a bunch of forms and as we all know, with forms come error messages.
What you often would do is something like this:
...
- and then have the same code for error messages in the next form and the next. But you can easily reuse these form error handlers and since you usually handle error messages the same way throughout your application using a shared file makes perfectly good sense.
So go back to your form template and add this little line instead:
{:class => 'form-horizontal'} do |f| %>
@order %>
and create a folder within apps/views/ called shared like this app/views/shared and in here you put
and there you have it, all you have to do now is put object %> into all your _form views and replace “object” with the current model your working on.