0

A have an error in simple form with field 'rich_text_area'.

  1. I typed command rails action_text:install.
  2. And I added a migration for already existed Model:
class MigrateCommentBodyToActionText < ActiveRecord::Migration[7.0]
  include ActionView::Helpers::TextHelper
  def change
    rename_column :comments, :body, :body_old
    Comment.all.each do |comment|
      comment.update_attribute(:body, simple_format(comment.body_old))
    end
    remove_column :comments, :body_old
  end
end
  1. Added @import 'actiontext' in app/assets/stylesheets/application.css.scss
  2. Added has_rich_text :body in Comment's model.
  3. My form looks like this:
<%= simple_form_for model, method: method do |f| %>
  <%= f.input :body, as: :rich_text_area, :label => t("comments.add_comments"), required: true %><br />
  <%= f.select :status, Comment::VALID_STATUES.collect{|status| status }, { selected: Comment::VALID_STATUES[0], class: "form-select form-select-sm", 'aria-label': ".form-select-sm example" } %><br /><br />
  <%= f.button :submit, class: "btn btn-light" %>
  <%= link_to "Cancel", article_path(@article), class: "btn btn-light" if f.object.persisted? %>
<% end %>

A have an image of the field but I cant click on it and input any text. what I could make wrong?

The image of the field

Elena
  • 11
  • 3
  • ActionText relies extensively on Javascript. Did you follow the [steps in the guide](https://guides.rubyonrails.org/action_text_overview.html#installation)? Have you tried any kind of actual problem solving like checking the browser console for errors and made sure Trix is present and working on the page? – max Nov 01 '22 at 16:30

0 Answers0