0

I have a problem with Rails, which may seem trivial to you, but I will describe below what is going on.

A set that I use everyday:

  • Ubuntu 18.04
  • ruby-2.4.0
  • Rails 5.2.1 (few days ago was and update to 5.2.2.1)

I had a problem with mysql for a few days, but I solved it and it works. I noticed that all projects stopped working for me at the local. When I try to run a project that was written in Rails 5.2.1, I get this error:

/home/mirek/.rvm/gems/ruby-2.4.0/gems/railties-5.2.1/lib/rails/railtie/configuration.rb:97:in method_missing': undefined methodactive_storage' for #Rails::Application::Configuration:0x00564a221eeae8 (NoMethodError)

The commands like rails s or rails c don't work and rails -T displays a very narrow list of available commands to use.

When I try to use rails db:schema:dump I get:

rails aborted! Don’t know how to build task 'db:schema:dump'

I also checked if other similar versions of Rails would also appear same error and it is the same. I'm looking for a solution in Google but still the same.

Can anyone help me with this?

Miro
  • 374
  • 3
  • 10
  • Prepend `bundle exec` like: `bundle exec rails c`. – Aleksei Matiushkin Mar 19 '19 at 15:15
  • @AlekseiMatiushkin I tried this and I got: > /home/mirek/.rvm/gems/ruby-2.4.0/gems/railties-5.2.2.1/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `active_storage' for # (NoMethodError) – Miro Mar 19 '19 at 15:16
  • Does your `Gemfile` has `gem 'rails', '~> 5.2.2'` line? Have you run `bundle install` after `Gemfile` was updated? – Aleksei Matiushkin Mar 19 '19 at 15:20
  • 1
    @Miro is `active_storage` required in your application.rb file? If not and you need it then add `require 'active_storage/engine'`. If you do not need active storage then comment out the line in question from your environment files (other files may need changes as well) [See Here](https://stackoverflow.com/questions/49813214/disable-active-storage-in-rails-5-2) – engineersmnky Mar 19 '19 at 15:21
  • Double check active_storage installation https://github.com/rails/rails/tree/master/activestorage#installation and that the gem is properly installed by bundler. – arieljuod Mar 19 '19 at 15:26
  • Still not working after all your answers. – Miro Mar 19 '19 at 15:36
  • @Miro you are going to have to be more specific. The error you are receiving means that the `ActiveStorage::Engine` is not loaded can you confirm whether or not you need `ActiveStorage` and if you do can you confirm that your application.rb file includes the line I mentioned? – engineersmnky Mar 19 '19 at 15:56
  • @engineersmnky I tried to do this with line `require 'active_storage/engine'` but it doesn't help. Actually I think that I don't need `ActiveStorage` – Miro Mar 19 '19 at 20:42
  • @engineersmnky I don't have this line right now but still the same :) – Miro Mar 19 '19 at 20:51
  • @engineersmnky All my files: application.rb, development.rb, production.rb and test.rb are free of active_storage lines. – Miro Mar 19 '19 at 21:10
  • Post the whole stack trace then. – engineersmnky Mar 19 '19 at 21:15
  • @engineersmnky I think that it is deeper problem because I cant's work with other RoR projects on my computer. – Miro Mar 19 '19 at 21:28
  • @engineersmnky When I comment lines `config.active_record.migration_error = :page_load`, `config.active_record.migration_error = :page_load` and `config.active_record.verbose_query_logs = true` I can run Rails server with no errors but other Rails commands like `rails db:schema:dump` still don't work and give en error: `rails aborted! Don't know how to build task 'db:schema:dump' (See the list of available tasks with `rake --tasks`)` – Miro Mar 19 '19 at 21:29

1 Answers1

0

It started after an update? Are you working in a linux environment? Check your file permissions and owner:group values, they may have changed after your update and you may need to switch to root to set them back to a usable state. Obvious? Maybe, but this has caught me out too many times lately!

  • I reinstalled Ubuntu 18.04 and I configured the whole environment and now everything works fine. – Miro Apr 01 '19 at 14:08