Can't dup NilClass on association methods

后端 未结 2 1000
悲&欢浪女
悲&欢浪女 2021-01-14 12:23

I\'m using rails 2.3.5 and ruby 1.8.7. I\'m building a simple TODO manager. Where I have tasks that belong to a user and a user has many tasks.

I\'m using act

2条回答
  •  清酒与你
    2021-01-14 13:01

    Got it.

    From here,

    Some of the classes inherited or included in your engine controllers may fail to get unloaded and cause trouble after the first request to your system.

    For me, it was because I had a file in the lib that was monkey patching User model and the User model class in this file was not getting cached I suppose.

    Calling unloadable in that class in the lib folder did the trick. So my lib file looks like this

    class User < ActiveRecord::Base
      unloadable
      # stuff...
    end
    

    Thanks anyways.

提交回复
热议问题