2

This mysterious error was showing just after action text was installed on development environment and then vanished without any change on the code.

After many tests and working ok on localhost I pushed to production (heroku) and it came back:

undefined method `rich_text_area_tag'

enter image description here

Config:

models/mailing.rb

class Mailing < ApplicationRecord

  has_rich_text :body

end

Ruby 2.6.5 Rails 6.0.0

Fillype Farias
  • 622
  • 1
  • 8
  • 20

2 Answers2

0

I'm using ActiveAdmin with friendly_id gem. To avoid conflict, I've added this chunk of code to active_admin initializer.

  ActiveAdmin::ResourceController.class_eval do
  end

Which cause same error as you have.

Manually overriding controller did the trick

ActiveAdmin.register Category do
  controller do
    def find_resource
      if resource_class.is_a?(FriendlyId)
        scoped_collection.friendly.find(params[:id])
      else
        scoped_collection.find(params[:id])
      end
    end
  end
end
Max Paprikas
  • 579
  • 6
  • 16
0

I think its because some gem or load order issue and it's kinda hard to debug

current workaround is by adding the helper manually to application_controller.rb

require 'action_text'

class ApplicationController < ActionController::Base
  helper ActionText::Engine.helpers

  ...
end

extra references https://github.com/rails/rails/pull/38859

https://github.com/spree/spree/issues/9412

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

as for me

this problem is showed up because I put a class on my devise config files

buncis
  • 2,148
  • 1
  • 23
  • 25