-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Getting Error: 'No connection pool for ActiveRecord::Base' when generating the devise_token_auth generator inside an Rails Engine #584
Comments
+1 |
1 similar comment
+1 |
If it helps anyone, you can resolve it by manual creating migration file, add routes, add all stuff that generator do. |
This bug comes from the devise_token_auth gem where the gem checks the database is Postgres or not in 'postgres?' method. So I just done a monkey patching inside the method and returned true (just say 'yes' to postgres? method, because I am using postgres). And run the generator again. Hope this will be soon solved by the authors of 'devise_token_auth' gem. |
Sounds like we have a proposed solution here, so closing for now. |
I have an Rails Engine in my app (authentication_manager). I tried to implement this gem inside my engine. So I added this gem inside the engines Gemfile and installed it.
But I am getting the following error:
No connection pool for ActiveRecord::Base (ActiveRecord::ConnectionNotEstablished)
I am using postgresql and all configuration is correct. And I tried devise and generated it inside this engine and not found any issue.
vagrant@vagrant-ubuntu-trusty-64:~/my-app/components/authentication_manager$ rails g devise_token_auth:install User auth
'create config/initializers/devise_token_auth.rb
create db/migrate/20160324104352_devise_token_auth_create_user.rb
/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:570:in
retrieve_connection': No connection pool for ActiveRecord::Base (ActiveRecord::ConnectionNotEstablished) from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in
retrieve_connection'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in
connection' from /home/vagrant/.rbenv/versions/2.2.1/gemsets/my-app-authentication-manager/gems/devise_token_auth-0.1.37/lib/generators/devise_token_auth/install_generator.rb:151:in
database_name'from **/home/vagrant/.rbenv/versions/2.2.1/gemsets/my-app-authentication-manager/gems/devise_token_auth-0.1.37/lib/generators/devise_token_auth/install_generator.rb:135:in
postgres?'** from /home/vagrant/.rbenv/versions/2.2.1/gemsets/my-app-authentication-manager/gems/devise_token_auth-0.1.37/lib/generators/devise_token_auth/install_generator.rb:131:in
json_supported_database?'from (erb):43:in
migration_template' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/2.2.0/erb.rb:863:in
eval'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/2.2.0/erb.rb:863:in
result' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/generators/migration.rb:64:in
block in migration_template'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in
call' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in
render'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in
block (2 levels) in invoke!' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in
open'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in
block in invoke!' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in
call'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in
invoke_with_conflict_check' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in
invoke!'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in
action' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/generators/migration.rb:34:in
create_migration'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/generators/migration.rb:63:in
migration_template' from /home/vagrant/.rbenv/versions/2.2.1/gemsets/my-app-authentication-manager/gems/devise_token_auth-0.1.37/lib/generators/devise_token_auth/install_generator.rb:18:in
copy_migrations'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in
run' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in
invoke_command'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
block in invoke_all' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
each'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
map' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
invoke_all'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in
dispatch' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in
start'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/generators.rb:157:in
invoke' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/generate.rb:13:in
<top (required)>'from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/engine/commands.rb:19:in
require' from /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/engine/commands.rb:19:in
<top (required)>'from bin/rails:12:in
require' from bin/rails:12:in
The text was updated successfully, but these errors were encountered: