Aryk Grosz wrote:
What was the intended way to include files that extend AR models?
For example, I have a class called
UserAction < ActiveRecord::Base end
I would like to include test.rb file in environment.rb that subclasses UserAction like so :
CommentUserAction < UserAction end
However, if I do this with cache_classes = false, then things will get screwed up because UserAction will get unloaded between requests.
I tried to use "require_dependency 'test.rb'", but I was running into problems with that as well.
In the past we'd use something like "include Reloadable" but thats deprecated now.
Any help would be greatly appreciated.
Can you put test.rb in the lib or models directories as comment_user_action.rb?
If not, below your "require test.rb" in environment.rb add "CommentUserAction". This should trigger loading of both classes.