Home>
problem

I ran a command to create a new model, but I get the following error and cannot create a model.

ubuntu: ~/environment/first_app (master) $rails g model Country name: string
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actiontext-6.0.3/lib/action_text/engine.rb:47:in `block (2 levels) in<class: Engine>': uninitialized constant ActionText :: Engine :: ApplicationController (NameError)
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb: 428: in `instance_exec'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb: 428: in `block in make_lambda'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:200: in `block (2 levels) in halting'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb: 605: in `block (2 levels) in default_terminator'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:604:in `catch'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:604: in `block in default_terminator'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:201: in `block in halting'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb: 513: in `block in invoke_before'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:513:in `each'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:513:in `invoke_before'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:134: in `run_callbacks'from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb: 119: in `complete!'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:76: in `ensure in block in run!'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:76: in `block in run!'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:70:in `tap'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:70:in `run!'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:86:in `wrap'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3/lib/active_support/reloader.rb:51:in `reload!'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb: 168: in `serve'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
        from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /home/ubuntu/.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>'
What I tried

PC restart
EC2 restart
Change browser from chrome to safari

The reason I tried the above three is because I thought there was a problem with cloud9 itself.
That's because something is written on the top line of the error.

/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actiontext-6.0.3/lib/action_text/engine.rb:47:in `block (2 levels) in<class: Engine>': uninitialized constant ActionText :: Engine :: ApplicationController (NameError)

There seemed to be an error in the ApplicationController, so I was curious and tried to look into the file.
But I can't open the file. As shown in the image below, the backslash next to the file name continues around.

By convention, only "when opening the application_controller.rb file" is not loaded.

So, I tried the above three to solve the phenomenon that only the application_controller.rb file cannot be opened, but none of them solves the problem. If the file is read properly, I think that the error when creating the model can be eliminated.

If anyone is familiar with this, please help.

  • Answer # 1

    Over time, the phenomenon of not being able to open files has not changed.
    I couldn't help it, so I created another new environment and started coding again.
    As a result, it is working well now.