letter_opener_web: Rails 5: api mode - undefined method `assets`
Getting this for clear rails 5 api-only app (rails new myapp --api
):
/home/oivai/.rvm/gems/ruby-2.3.0/bundler/gems/rails-513f72804d80/railties/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined met
hod `assets' for #<Rails::Application::Configuration:0x000000047352b8> (NoMethodError)
Did you mean? asset_host
from /home/oivai/.rvm/gems/ruby-2.3.0/bundler/gems/letter_opener_web-55c581e463e7/lib/letter_opener_web/engine.rb:16:in `block in <class:E
ngine>'
from /home/oivai/.rvm/gems/ruby-2.3.0/bundler/gems/rails-513f72804d80/railties/lib/rails/initializable.rb:30:in `instance_exec'
from /home/oivai/.rvm/gems/ruby-2.3.0/bundler/gems/rails-513f72804d80/railties/lib/rails/initializable.rb:30:in `run'
from /home/oivai/.rvm/gems/ruby-2.3.0/bundler/gems/rails-513f72804d80/railties/lib/rails/initializable.rb:55:in `block in run_initializers
'
Is there a workaround? Thank you!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (4 by maintainers)
The instruction found at rswag issue #12 worked for me. Try to uncomment
require "sprockets/railtie"
inconfig/application.rb
and see if it works for you too!I had the exact same issue installing activeadmin on rails5 --api, and uncommenting
require "sprockets/railtie"
inconfig/application.rb
solved the problemIt is still reproducing for me. Rails 5.2.3 (API mode) letter_opener_web 1.3.4
If I’m adding
require 'sprockets/railtie'
to application.rb, the next error I’m experiencing isSo I need to create this file. It’s not a good option for me, because I’m writing the application based on engines and completely don’t have
app
directory. Any ideas?In the meantime, I added the following to my Gemfile:
gem ‘letter_opener_web’, github: ‘fgrehm/letter_opener_web’, ref: ‘d6c6455’
Thank you @flaviocamilo this solution still works!