Home > Software design >  When I run migration, config.assets is not working in rails 7
When I run migration, config.assets is not working in rails 7

Time:08-25

I recently upgraded my application from rails 6.1 to rails 7.0.3 and I am facing some issues after that.

Following lines are defined in my development.rb file:

config.assets.debug = true
config.assets.digest = true
config.assets.raise_runtime_errors = true

But when I run migration I get the following error:

NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x00007f6c2d5eb0c8 @root=#<Pathname:/app>

Although migration runs fine after commenting the above lines. I am not really sure why this is happening. Please let me know if anyone has any idea about this.

CodePudding user response:

My guess is that you removed the sprockets-rails gem in favor of webpacker.

config.assets comes from this gem and is no longer needed if you stopped using this.

options explanation on github

Note that the config.assets.raise_runtime_errors is no longer available in recent sprocket versions and is always enabled.

  • Related