Could anyone share some advice on the topic subject?
I wonder what is the best way to display validation messages next to input they belong to.
So far I created a helper, which uses exposed array with those messages and checks if there are any messages to be displayed for this input. If there are, it generates some HTML with those messages and injects it in the place in template where it was called.
form_for :user, routes.login_path do
p display_errors :login
p display_errors :password
return nil if result.messages[field].nil?
result.messages[field].each do |m|
Is this the proper way? Why do I need to prepend this helper with p to render the content of html returned by helper? Is it because it's inside a form_for block? How do you deal with this?