Saturday, 18 August 2012

Rails : Alert message with new line

I was passing the error message by joining each error message with \n and in alert I am getting all error message with \n text instead of new line, below is the code which am passing the message
@product.errors.full_messages.join('\n')
and I am getting something like below Name can't be blank \n Address can't be blank After doing search in google some how I got that I have to give \n in double quote like below
@product.errors.full_messages.join("\n")
and it works..

No comments:

Post a Comment