Monkey-Patching User in ChiliProject
Here is how to patch the
User model within a ChiliProject plugin.
What’s the deal?
When ever you try to patch the
User model you will see weird errors like
Expected user.rb to define User and such. Sometimes it is even more subtile.
The cause is often, that the tight dependecies between the
Project models are not loaded properly - most often caused by a plugin
require_dependency to load one of them.
And the fix:
I was running into this problem multiple times and I wanted to note - once and for all - you will need the following statements to make it work:
require_dependency 'project' require_dependency 'principal' require_dependency 'user'
Then everything should be good to go.
See it in action
I mainly work with Rails, Backbone, and Bootstrap, but I am also good at picking up new frameworks, since I will probably know most of their concepts from other projects.