Skip to content

Commit a517c32

Browse files
authored
Use Field::RichText type for has_rich_text (#2926)
Detects ActionText rich text associations based on the class name and attribute when using the generators and set the type to `Field::RichText`. Fixes #2925
1 parent ca911f0 commit a517c32

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/generators/administrate/dashboard/dashboard_generator.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ def column_types(attr)
128128

129129
def association_type(attribute)
130130
relationship = klass.reflections[attribute.to_s]
131-
if relationship.has_one?
131+
if relationship.name.start_with?("rich_text_") &&
132+
relationship.options[:class_name]&.start_with?("ActionText::")
133+
"Field::RichText"
134+
elsif relationship.has_one?
132135
"Field::HasOne"
133136
elsif relationship.collection?
134137
"Field::HasMany"

0 commit comments

Comments
 (0)