I have a problem with passing Validation error messages from my model
'Visitor' to my view 'index.html.erb'.
When I pass an invalid surname from the form on my view, I correctly
get an invalid response on my error page when I use the render :action
=> 'error command in my controller.
However I want this error message to appear on my index page and I
want the form to be redirected to this page.
My question is how can I pass the error failure from my model to the
view, using a redirect_to?
I've finally figured out the problem.
The reason I didn't use render was that when I did my page kept
forwarding onto an unwanted URL route, so I used redirect_to, but I
didn't really think about the fact that I would loose the request data
as redirect_to is a new request.
Anyway it turns out that because I was using index_controller.rb and a
view called index.html.erb that some how this was affecting my
routing.
I then switched to using a different RESTful resource and used render
and it all worked like clockwork.