Hiall,
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.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/FEK3UTBMcVoJ.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment