bootstrappers icon indicating copy to clipboard operation
bootstrappers copied to clipboard

undefined local variable or method `current_user' for

Open xcopter opened this issue 11 years ago • 8 comments

installed latest gem (4.2). under ruby 2.0.0, rails 4 error occur when first "rails s"

screen shot 2013-08-31 at 5 23 54 pm

xcopter avatar Aug 31 '13 09:08 xcopter

same problem.

Jeswang avatar Sep 01 '13 15:09 Jeswang

have you guys run " rake db:migrate " after generating?

Unayung avatar Sep 05 '13 09:09 Unayung

Problem solved after several steps. But I forget the details. Kind of things like what you say. @Unayung

Jeswang avatar Sep 05 '13 09:09 Jeswang

it's problem of database,

come to config/database.yml

back to default set:

development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000

test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000

production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000


and go to gemfile add : gem "sqlite3"


$ rake db:migrate

sdlong avatar Dec 12 '13 06:12 sdlong

I found the error is because devise, you can run the following command: rails g devise:install rails g devise user rake db:migrate

beer avatar Dec 24 '13 11:12 beer

I followed instructions from rails-101, generated the group model in exercise 1 and encountered the same problem, I tried " rake db:migrate " after generating, and the same problem still exists.

yuyueugene84 avatar Sep 04 '14 08:09 yuyueugene84

you need install devise, try

$ rails g devise:install

$ rails g devise user

sdlong avatar Sep 04 '14 08:09 sdlong

Finally solved the problem, after running "rails g devise:install", make sure the following steps are completed:

2014-09-04 9 25 22

yuyueugene84 avatar Sep 04 '14 10:09 yuyueugene84