I'm struggling with MMC. The connections to the different databases
work like a charm.
But when I define a method in a model, this method is unknown in the
subclass.
For example:
class Relationgroup < ActiveRecord::Base
set_primary_key "nummer"
has_many :relations, :foreign_key => 'rel_groepsnummer', :conditions
=> "rel_groepsnummer != ''", :order => "rel_naam"
def self.get_grpnumber
g = @mod::Relationgroup.find(:first, :order => "created_at
DESC", :limit => 1)
num = g.nummer[3,7].to_i + 1
"GRP" + num.to_s.rjust(5, "0")
end
end
In the controller:
@relationgroup = @mod::Relationgroup.new(params[:relationgroup])
@
relationgroup.id = @relationgroup.get_grpnumber
Throws the following error:
undefined method `get_grpnumber' for
#<WegenerdbConnection::Relationgroup:0x436c9d8>
Please advice.