rails 4 engine optional shared helper -
i upgraded engine rails 4 , i'm having problems trying configure optional shared helper. helper assessable::displayhelper
has 2 methods render html.
what mean optional is
- the default config desired helper should made available main.app use outside engine, details hidden. (the html generated hash generated engine used main app)
- an optional generator installs helper in helpers/assessable/display_helper app user can modify if wish.
the optional generator works fine, over-riding helper in engine, can't figure out way make default mode work.
i've read note helper load order in rails 4 release notes, not sure need change. i've tried
- adding
helper assessable::displayhelper
application controller (not preferred) - trying include
assessable::displayhelper
in stubbed helper. - a few other stabs in dark
produces , error:
runtimeerror: circular dependency detected while autoloading constant assessable::displayhelper ... /users/me/.rvm/gems/ruby-2.0.0-p247@rails4/gems/actionpack-4.0.0/lib/action_controller/railties/helpers.rb:17:in `inherited' /users/me/work/pm/app/controllers/application_controller.rb:1:in `<top (required)>'
i gone , forth between having display functions in class , in helper. switched helper because had trouble getting class installed in main app. goal have `{class.}display_xxx(hash,post) work either default or optional config.
any suggestions on either approach helpful.
i gave up. know 1 looking @ rails4, @ least yet.
i ended using 1 old suggestion , generating included helper in applications helper directory - versus name-spaced directory. not want wanted do, maybe sometime later i'll figure out. install:helper method replaces helper include full code.
Comments
Post a Comment