I am converting my Rails 2 app to Rails 3. So far, I've been successful. However, there is this strange issue that I have to explicitly require any external files. Here is my original (i.e. Rails 2) ActiveRecord model:
class Book < ActiveRecord::Base
belongs_to :author
has_many :translations, :dependent => :destroy
include Freebase
...
end
in order to make it working in Rails 3, I have to require the model Translation and Freebase.rb file, thus:
class Book < ActiveRecord::Base
require File.expand_path(File.dirname(__FILE__) + '/translation.rb')
belongs_to :author
has_many :translations, :dependent => :destroy
require File.expand_path(File.dirname(__FILE__) + '../../../lib/freebase.rb')
include Freebase
...
end
Is it the normal way in Rails 3, or I am doing something wrong. In other words, why is it necessary to explicitly include those files? There might probably be some reason for the Freebase.rb file, which is placed in the lib folder, but what about the Translation model which is in the same dir?
Thanks guys!