Ruby on Rails model inside namespace can't be found in controller

后端 未结 4 1885
旧时难觅i
旧时难觅i 2021-02-04 11:52

I\'m new to rails and can\'t figure out this issue...

I have a controller

Admin::Blog::EntriesController

defined in app/controllers/adm

4条回答
  •  伪装坚强ぢ
    2021-02-04 12:20

    It is now 2011 and we are in Rails 3.1 territory, but this issue still arises. I just ran into it with a namespaced controller referencing a non-namespaced model, but only when there were no rows for that model in the database!

    Prefixing the model name with :: fixes the problem.

提交回复
热议问题