I'm working more on my first live Rails app using 3.1.0 with M. Hartl's guide and Postgres. I've moved onto Chap 10 in working in the authentication. Instead of pages, I'm using openings. Apart from that, I'm following his users, sessions, from chap 6 on. When I go to the users/index.html.erb I'm getting the following error:
PGError: ERROR: operator does not exist: character varying = integer LINE 1: ...CT "users".* FROM "users" WHERE "users"."email" = 8 LIMIT
Reading up on similar strings on stackoverflow, the consensus seems to be that the id field is not set to integer. I can confirm it is integer. If I was to regenerate this field, it would seem to me that this field was created by rails when I generated the model. Since that would be true, should I regenerate an id field in an early migration that would be automatically generated by Rails? I seem to read somewhere that's a bad idea.
But I don't think that's my problem. Looking at the error makes me think that it's looking for a user's email that is "8" and not something like 'joe@example.com'. If that's true, then I've got a mismatch between the expected id field and the email field. That would be expected, but how do I find/understand my mismatch? Because this is due to my inexperience, I started looking at my backtrace to see if I can find what's different. I'm cheating by looking at gabebw's copy on github and not finding anything different apart from the later chapters in his code.
How should I learn what to do? I struggle between the difference between @user, @users, users, user in code. I understand its due to the context of how it's used and that a variable should match up to its relationship in view, helper, controller, model. How did you learn it? If someone is willing my troubled push is up on my github/sam452/vitae in the authenticate1 branch. thx, sam452.
It appears that it is not the varchar, after I reset and migrated the database. So looking at the authenticate methods, I found the user model was calling for the email field, when it should be the id. So the theory that the mismatch between email and the id fields was correct. Thanks.