AR mixin NoMethodError

I’ve searched on the net and found others have used mixins with AR in
various ways.

I’ve done the following:
File: …/models/my_mod.rb
module MyMod
def self.doit
end
end

File: …/models/my_model.rb
class MyModel < ActiveRecord::Base
include MyMod
def do_this
end
end

I believe I am using Mixins correctly, but it seems AR behaves
differently.
I am getting a NoMethodError with ‘method_missing’ when I try to use

MyModel.doit

in a controller. What am I missing? Is this the side-effect of AR’s use
of
‘method_missing’ to generate accessors dynamically?

Thanks for any thoughts,

Long

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