I have two models that contain the same method:
def foo
# do something
end
Where should I put this?
I know common code goes in the lib directory in a Rails app.
But if I put it in a new class in lib called 'Foo', and I need to add its functionality to both of my ActiveRecord models, do I do that like this:
class A < ActiveRecord::Base
includes Foo
class B < ActiveRecord::Base
includes Foo
and then both A and B will contain the foo method just as if I had defined it in each?