6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby on Railsチュートリアルを進めて、has_secure_passwordあたりでテストしたら「NoMethodError: undefined method `password_digest=」と出た場合の解決法について

Last updated at Posted at 2016-06-17

問題

Ruby on Rails チュートリアル:実例を使って Rails を学ぼうを進めていて、第6章の、has_secure_passwordあたりでテストしたら「NoMethodError: undefined method `password_digest=」と出てテストが通らない。

原因

どうやら、test用のDBにdevelopment用のDBの内容が反映されないからのようだ。
なお、使用Railsのバージョンは、4.2。

解決策

ターミナルでrake db:test:prepareで解決するようだ。少なくとも、自分は今それで解決してテストも通るようになった。

$ rake db:test:prepare

参考URL

(以下、同じ問題だけど解決してない)

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?