14
I'm trying to split a large model into multiple files for logical organization. So i have two files:
model1.rb
class Model1 < ActiveRecord::Base
before_destroy :destroying
has_many :things, :dependent=>:destroy
def method1
...
end
def method2
...
end
end
require 'model1_section1'
model1_section1.rb
class Model1
def method3
...
end
def self.class_method4
...
end
end
but when the app loads, and there is a call to Model1.class_method4, i get:
undefined method `class_method4' for #<Class:0x92534d0>
i've also tried this for the require:
require File.join(File.dirname(__FILE__), 'model1_section1')
What am i doing wrong here?