Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't migrate database after 'rails g devise_token_auth:install User auth' #781

Closed
dgleba opened this issue Dec 1, 2016 · 7 comments
Closed

Comments

@dgleba
Copy link

dgleba commented Dec 1, 2016

I am following the steps on the readme.md.

I do this.. rails g devise_token_auth:install User auth

Then:
The first line in the migration file says:

class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]

If i remove the [4.2], it works.

Is there a way to avoid this?
I am using this in a script and it would be nice if it didn't do this.

The error if the [4.2] is left in is:

albe@v206x20161030220807:~/share203/dta2g$ rake db:migrate
-- [](4.2)
-- [](4.2)
rake aborted!
NoMethodError: undefined method `[]' for #<ActiveRecord::Migration:0x007fb5459dda30>
/home/albe/share203/dta2g/db/migrate/20161201020449_devise_token_auth_create_users.rb:1:in `<top (required)>'
NoMethodError: undefined method `[]' for #<ActiveRecord::Migration:0x007fb5459dda30>
/home/albe/share203/dta2g/db/migrate/20161201020449_devise_token_auth_create_users.rb:1:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
albe@v206x20161030220807:~/share203/dta2g$ 

@kedarnag138
Copy link

@dgleba I had the same issue, and removed that to make it to work. Although, I actually thought I had typed [4.2] by mistake. I am not sure, why that gets added in the migration. Could somebody please explain.

@adamw005
Copy link

adamw005 commented Jan 7, 2017

I also had this issue, and removing [4.2] worked for me as well

@Saulgor
Copy link

Saulgor commented Jan 13, 2017

I got this issue too...

@fabianprado
Copy link

It got it too

@zachfeldman
Copy link
Contributor

Workaround posted, closing for now

@maricavor
Copy link

maricavor commented Feb 7, 2018

Hi! I am still getting this after I am trying rails g ...:

  --[](4.2)
  /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:664:in `block in method_missing': undefined method `[]' for #<ActiveRecord::Migration:0x007fce10a866b0> (NoMethodError)`
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:634:in `block in say_with_time'
from /Users/Sergei/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:634:in `say_with_time'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:654:in `method_missing'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:416:in `method_missing'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/encrypted_store-0.3.0/lib/generators/encrypted_store/upgrade/ZeroOneFive/templates/upgrade_encryption_keys_to_015.rb:1:in `<top (required)>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `block (2 levels) in <class:Railtie>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `block in <class:Railtie>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `call'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `block in run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:245:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:245:in `each_registered_block'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/application.rb:462:in `block in run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/application.rb:462:in `run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/engine.rb:461:in `load_generators'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:129:in `generate_or_destroy'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:50:in `generate'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/Sergei/.rvm/gems/ruby-2.2.5@rails4/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

Why --[](4.2) appears after command, and why rails generate command is not working at all after this. It happened after I did bundle update.

@zachfeldman
Copy link
Contributor

@maricavor your stack trace is hard to read, can you be more specific?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants