Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Helpers in Rails engine

I am working on a rails engine and I have a problem with the helpers.

Apparently this is a known "problem" but there's not a lot of solutions out there. The problem is that I have an AuthenticationHelper which I want to access globally - but it's not working.

I've read that you could add a few lines to your init.rb but it does not seem to have any effect.

Any idea what the best way to make an application available in an engine?

EDIT: Fixed it- Just put the code (from the link) in the engine.rb instead.

like image 455
Markus Avatar asked Nov 06 '11 15:11

Markus


1 Answers

Put this code in engine.rb:

config.to_prepare do
  ApplicationController.helper(MyEngineHelper)
end
like image 129
Brad Werth Avatar answered Sep 28 '22 11:09

Brad Werth