22
14

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.

deviseでno method in devise::registrationscontroller#create undefined method current_sign_in_at

Last updated at Posted at 2018-09-27

deviseで
no method in devise::registrations controller#create undefined method current_sign_in_at
が出ました。
調べてみると、rakedb:migrate忘れが原因だということだった。
https://stackoverflow.com/questions/21383860/nomethoderror-in-devisesessionscontrollercreate-undefined-method-current-sig

という訳ではないらしい。(英語読めないからもっと勉強しよう)

試した方法は、

class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
  t.string :first_name
  t.string :last_name
  t.string :profile_name
  t.string :college_name
  ## Database authenticatable
  t.string :email,              :null => false, :default => ""
  t.string :encrypted_password, :null => false, :default => ""
  ## Recoverable
  t.string   :reset_password_token
  t.datetime :reset_password_sent_at
  ## Rememberable
  t.datetime :remember_created_at
  ## Trackable
  t.integer  :sign_in_count, :default => 0
  t.datetime :current_sign_in_at
  t.datetime :last_sign_in_at
  t.string   :current_sign_in_ip
  t.string   :last_sign_in_ip

deviseのmigtration fileのcurrent_sign_in_atが書かれている##のところのコメントアウト(trackableのところですかね)を外してrollback => migrateすると動きました。(以前はこんなエラーにならなかったのに・・・)

なぜエラーが出てたのかはわかりませんでしたので、わかる方御教授ください。

22
14
2

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
22
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?