Help with error messages

Hiall,

Please bear with me as I am new to rails.

I have the following problem:

I have 2 models, Client and Product. Product is dependent, and as such,
within the Client show view I created a Product creation form, to create
products that belong to a client. After successful or unsuccessful
creation
I return to the Client show view. There I wanted to show any errors if
the
creation went wrong, but I can’t seem to be able to access the @product
I
used when trying to create the Product instance, to get to its errors.
Do I
have to pass that @product when redirecting to client_path(client)? And
if
so, how?

BTW, success works, as I use flash to show that, but with the errors I
did
want to show them in a different position, above the form. If nothing
else
works, I guess I should pass the errors to flash, but I don’t know how
to
do that either.

can you show us the piece of code you using to handle the success case?

flash is an hash with very useful entries:

inside your controller you should be doing something like:
flash[:error] = object.errors

or something like that if you pass us your controller code it would be
easier to help you and what is that you doing on the case of no
success.