I am following ruby.railstutorial.org. I have had some troubles, but I solved them. Now, however, I am googling for quite some time, checked the code, I even have an idea why te
This line does have problem
user_with_same_email = @user.email.upcase
user_with_same_email
is an object, you need to set the email attr instead of the object itself.
user_with_same_email.email = @user.email.upcase
It's saying user_with_same_email is a string and doesn't have a save method.
Guessing, I'd say you need to create a user object with that email, so you can test that your code finds it and throws the validation.
I was briefly sidetracked by this error in the instruction myself. In general if one encounters any similar issues I recommend going to the help section of the tutorial. If the issue isn't covered there then you could check out the link to the Official Sample Code
that links to github. The code for this issue is correct on that repository. Cheers.