ruby-on-rails - Rails 6 ActionText 不适用于 Heroku(未定义的方法 'rich_text_area_tag')
问题描述
我正在使用 ActionText 来编辑一个段落,它在本地工作得很好,但是当我将它部署到 Heroku 时,即使我遵循了 rails 指南,它也会抛出一个错误,说 undefined method rich_text_area_tag 。我以为我需要在生产环境中配置 Active Storage,但事实并非如此。
这是我在 Heroku 的日志中得到的信息:
ActionView::Template::Error (undefined method 'rich_text_area_tag' for #<#<Class> Did you mean? rich_text_area)
<%= f.label :something, class:'label' %>
<%= f.rich_text_area :something %>
解决方案
我在网上找到了这个,它对我很有帮助:
https://github.com/JoeWoodward/spree_helper_issue
我不确定这是否是正确的方法,但这是一种临时解决方法。
解决方案:
在application_controller.rb
输入以下内容:
require 'action_text'
class ApplicationController < ActionController::Base
helper ActionText::Engine.helpers
...
end
文档helper
:https ://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper
推荐阅读
- c# - 使用 Fiddler 左右跟踪 WebDriver 请求
- linux - 获取 Xorg 下插入符号(输入文本光标)的 X/Y 位置?
- events - 在 VB6 中,为什么事件处理在睡眠循环中停止?
- c++ - 类模板扣减指南-MVS上的错误
- javascript - 如何修复此计算器 UI?(来自code.org的Javascript)我将在下面解释
- ios - swift-ios- 辅助功能 - 先将 Voiceover 阅读/焦点顺序更改为内容视图,然后是导航项?
- python - 如何用冒号分割字符串,但不是时间?
- image - 谁能告诉我这是什么类型的编码
- kotlin - LiveData 上的更改不会更新 UI
- scala - 累加器未显示在 Spark UI 中