Skip to content

Commit a41839d

Browse files
smartygusnickcharlton
authored andcommitted
Use Field::RichText type for ActionText has_rich_text associations
- detects ActionText rich text associations based on class name and attribution name and if it's a match, returns the built-in Field::RichText type
1 parent fb51712 commit a41839d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/generators/administrate/dashboard/dashboard_generator.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ 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_') && relationship.options[:class_name] && relationship.options[:class_name].start_with?('ActionText::')
132+
"Field::RichText"
133+
elsif relationship.has_one?
132134
"Field::HasOne"
133135
elsif relationship.collection?
134136
"Field::HasMany"

0 commit comments

Comments
 (0)