Rails console - use image_tag method

前端 未结 2 1068
太阳男子
太阳男子 2021-02-08 09:39

How can I execute a image_tag method in a Rails console

  1. Run the console $ rails c

  2. Load helpers

    include ActionView::Helper

2条回答
  •  难免孤独
    2021-02-08 10:29

    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.

提交回复
热议问题