Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failure in Rails Tutorial (Hartl) -section 7 - "unkown attribute: password"

I've searched this issue on the forum and have used a solution on the spork site to remove "--drb" from spec options, got it to load and run and still this persistent error keeps popping up. I've also run it without spork. I've read ahead on a bunch of rspec info and as stated dug through spork info, but nothing yet. I've also ran checks for typos, indentation, encoding... and am at a loss still. Other issues, I've been able to fix, but this one's got me. Here it is below if anyone has a suggestion:

Failures:

1) User password encryption has_password? method should be false if the passwords don't match Failure/Error: @user = User.create!(@attr) ActiveRecord::UnknownAttributeError: unknown attribute: password # ./spec/models/user_spec.rb:94:in `block (3 levels) in '

Finished in 0.836 seconds 1 example, 1 failure <-- Slave(1) run done!

like image 906
user652494 Avatar asked Feb 25 '23 16:02

user652494


1 Answers

are you certain you have added :password as a virtual attribute on your User model? It's easy to miss but you need to include the line

attr_accessor :password
like image 181
GrahamJRoy Avatar answered Apr 28 '23 18:04

GrahamJRoy