Here’s a question for those well-versed in rforum or engines – or
both, ideally I’ve spent some time today turning RForum into an
engine, using rails 1.0, engines trunk, and rforum 0.1 (as rforum
trunk didn’t appear to work out of the box).
My rforum engine works, but only when I do two things that I found by
trial and error:
- All rforum controllers subclass rforum’s ApplicationController. I
renamed it to RForumApplicationController, as the app using the
rforum-engine is likely to have its own ApplicationController. Now
when I try to use one of these controllers, it will work fine on the
first load after each server restart, but on subsequent pageloads I am
informed of "uninitialized constant RForumApplicationController.
This problem goes away when I put a load ‘rforum_application.rb’
at the top of each controller. A ‘require’ doesn’t do the job. My
question: why? I brooded over $ENGINES/lib/dependencies_extensions.rb,
but couldnt see the answer.
- In my app’s init_engine.rb I have to put
require ‘common_model_behaviors’ # 1
require RAILS_ROOT + ‘/config/app.rb’ # 2
When I leave out line 1, I get errors such as “uninitialized constant
ErrorRaising” (which is defined in ‘common_model_behaviors’). But that
very same file is loaded inside the app.rb! So I’m confused why both
lines 1 and 2 are required, when line 2 seems to me it should be
sufficient.
I’ve been trying to figure this out for too long now. So as its 8pm in
Europe I’ll have a beer hope you guys can help me out!
As an aside, You may have noted (while shaking your head) that I
renamed ApplicationController to RForumApplicationController, and not
RForum::ApplicationController. I did try, but broke localization in
the process. Any reason why this shouldnt work?:
module RForum
class ApplicationController < ActiveRecord::Base
include RForum::Localization
end
end
cheers
Gerret
cheers,
Gerret