I am super newb ruby ââ/ rails, so you will need to talk to me.
I created a small application that takes an email address and saves it, I set up validation on models (a unique and valid email address), and they both work.
I use the code below to try to save the email if it already exists, or its invalid format that needs to be stopped, and set an error message
def create
interest = KnownInterest.new( :email => params[:email] )
if(interest.valid? and interest.save)
flash[:notice] = "Thanks for showing interest, We'll be in touch with updates."
else
flash[:notice] = interest.errors.messages
end
redirect_to action: "index"
end
it spits out ["Email not valid"], how can I make it be a string (not what I think is an array, correct me if I am wrong)
Thank you so much
source
share