Pregunta

How do I call a helper inside an engine from the Rails console? I tried

app.coverart
app.refinery.coverart
helper.coverart
helper.refinery.coverart
Refinery::Books::Engine.helpers.coverart
Refinery::Books::Engine.app.coverart
Refinery::Books::Engine.app.helper.coverart

They all say NoMethodError: undefined method.

Rails version 3.2.14.

¿Fue útil?

Solución

If you want to include functions from Refinery::Books::ApplicationHelper you can do this like the following.

irb(main):001:0> include Refinery::Books::ApplicationHelper
irb(main):002:0> respond_to? :function_from_engine_helper
=> true
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top