ruby-on-railsherokuruby-on-rails-6actiontext

Rails 6 ActionText isn't working on Heroku (undefined method 'rich_text_area_tag')


I am using ActionText to edit a paragraph and it works perfectly locally but when I deploy it to Heroku the page which has the form with rich_text_area it throws an error saying undefined method rich_text_area_tag even though I followed the rails guide. I thought I needed to configure Active Storage on production but that's not the case.

Here is what I am getting in Heroku's logs: 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 %>

Solution

  • I found this online, and it was helpful for me:

    https://github.com/JoeWoodward/spree_helper_issue

    I am not sure if this is the correct way to do it, but it's a temporary workaround.

    SOLUTION:

    In application_controller.rb enter the following:

    require 'action_text'
    
    class ApplicationController < ActionController::Base
      helper ActionText::Engine.helpers
    
      ...
    end
    

    Docs for helper: https://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper