简体   繁体   中英

How do I access a helper in an engine from the Rails console?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM