Engines layout/helper problem


So I finally decided to start playing around with Rails Engines.
After getting my initial controller problem solved (and I see it’s
fixed in the 1.0.3 release), I have run into another issue which is
giving me a headache.

When I hit my default controller (app/controllers/home_controller.rb)
everything works fine. I get my default layout and my helpers work.

When I hit my engine controller
(vendor/plugins/daub_engine/app/controllers/daub_test_controller.rb) I
get my view (vendor/plugins/daub_engine/app/views/daub_test/index.rhtml)
with no layout.

I tracked it down and found deep in
actionpack-1.11.2/lib/action_controller/layout.rb the method
active_layout is returning nil. In my default controller it returns
‘application’. Turns out that
self.class.read_inheritable_attribute(“layout”) is not returning
‘application’ for my enging views. Not sure why that is.

Not one to be to discouraged, I added the line “layout ‘application’”
to my engine controller. This successfully forced it to render my
view with the application layout. Unfortunately, my default
application helpers (app/helpers/application_helper.rb) are not being
loaded and I get an error that they are undefined methods.

At this point, I decided to turn to the mailing list and see if anyone
can help shed some light on this problem.


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