SQL error From Week 2

Currently
I’m about 15 minutes into Week 2: Writing Unit Tests.

I’m getting this error in both the sign_in_spec and manage_todos_spec:

ActionView::Template::Error: 
SQLite3::SQLException: no such column: owner_email.session: SELECT 
"todos".* FROM "todos" WHERE "owner_email"."session" IN ('current_email')

I’ve run rake db:migrate db:test:prepare several times to no avail.

I’ve checked my code against the tutorial and a few different repos from
other students and everything seems to be in order. Here’s a link to my
repo:

https://github.com/chrbradley/test-driven-rails-app1

I am on Rails 4 and using strong parameters instead of attr_accessible, but
it’s working with the todos :description attribute, so I’m not really sure
what the problem is.

Any thoughts?

What are you trying to do here?

def current_user
    User.new(session:[:current_email])
end

Shouldn’t this be

 User.new(email:session[:email]) ?

In the context of the lesson, I think we’re moving some logic out of application_controller into its own User class. I apologize for being vague, but I’m still trying to wrap my head around the content of the lesson.

Anyway, I tried your code and I get the same error. I do appreciate your response though.

Let me check out your code and run it.

Can you use this? This works.

def current_user
  User.new(session[:current_email])
end

Wow…time to get my eyes checked. Thanks a ton.

Your most welcome :smile: