Model mixin module madness

If I have several models which exhibit the same functionality, it seems
makes sense to create a mixin, ‘include’ it in each model and save
myself some work and repeated code.

Where can I define a module which will be available to all models? I
can’t seem to find a documented place for them.

Alternatively, is there a Rails-standard way of achieving the effect?


I’ve done this before by adding the mixin source file to the model
I suspect it would work from lib/ too.



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs