Expected to define. When calling class inside a module

后端 未结 6 1867
星月不相逢
星月不相逢 2020-12-15 05:12

I new to rails. I have a setup in the lib directory like so:

lib/
   blog/
     core/
        search/
            base.rb

The base.rb defin

6条回答
  •  鱼传尺愫
    2020-12-15 05:47

    My error with this was that I had

    app/
      controllers/
          projects/
              some_controller.rb
          projects_controller.rb
    

    I was trying to keep my app organized and, when having a namespace - was splitting up the controller. Unfortunately it looks like Rails would randomly jump between the two and there would be conflicts causing the error in OP.

    Solution: Rename your sub-directory and adjust any routes.

提交回复
热议问题