Rails console - use image_tag method

心已入冬 提交于 2019-12-03 06:07:29

Not sure why you're getting that error. It is strange.

But the Rails Console exposes the helper methods through the helper variable. So this should work:

helper.image_tag('test.png')

OK... I found the solution. The error is showing only in Rails 3 but I fixed it by setting the

  config.action_controller.asset_host = "http://..."
  config.action_mailer.asset_host = "http://..."

in my environemnt file (e.g. development.rb). Unbelievable!

This functionality is now part of a plugin https://github.com/xpepermint/js_erb.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!