igorkasyanchuk / rails_db

Rails Database Viewer and SQL Query Runner

Home Page:https://www.railsjazz.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`method_missing': undefined method `assets' for #<Rails::Application::Configuration

suminjames opened this issue · comments

rails c                     
/home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0x0000561b9d6a8fd8>
Did you mean?  asset_host (NoMethodError)
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/rails_db-2.1.1/lib/rails_db/engine.rb:7:in `block in <class:Engine>'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
        from /home/sumin/sumin/project/ideabreed/idea-signage-webapp/config/environment.rb:5:in `<main>'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
        from /home/sumin/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from -e:1:in `<main>'

Rails 6.0.0
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
rails_db (2.1.1)

Cause

    # /home/sumin/.rvm/gems/ruby-2.6.3/gems/rails_db-2.1.1/lib/rails_db/engine.rb
    initializer 'rails_db.assets_precompile', :group => :all do |app|
     > app.config.assets.precompile += ['rails_db/application.js', 'rails_db/application.css', 'rails_db/*.png', 'codemirror/*', 'codemirror/**/*']
    end

I had to add require "sprockets/railtie" in config/application.rb.
Found in issue here: fgrehm/letter_opener_web#46

@suminjames does the solution from @MackHatfield helps?

It partially helper me. After requiring of "sprockets/railtie" I now have this error:

Expected to find a manifest file in `app/assets/config/manifest.js`
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

I've created the empty file in app/assets/config/manifest.js and it helped, but the problem is I don't want to have the app directory in my base Rails application, because I'm using the Engines for everything.

I'm trying to resolve this error in this PR: #107
maybe soon I'll release a new version

pls try the latest version and let me know if it works

I had to add require "sprockets/railtie" in config/application.rb.
Found in issue here: fgrehm/letter_opener_web#46

Just had to implement this fix in an API rails setup. Rails 6.1.3.1 .