A have an error in simple form with field 'rich_text_area'.
- I typed command
rails action_text:install
. - 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
- Added
@import 'actiontext'
inapp/assets/stylesheets/application.css.scss
- Added
has_rich_text :body
in Comment's model. - 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?