Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ObiWanKeoni committed Jan 10, 2025
1 parent b5f0c6f commit 657c2da
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/avo/concerns/has_field_discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,26 @@ def discover_by_type(associations, as_type)
end

def discover_rich_texts
rich_texts.each do |association_name, reflection|
rich_texts.each_key do |association_name|
next unless column_in_scope?(association_name)

field_name = association_name&.to_s&.delete_prefix('rich_text_').to_sym || association_name
field_name = association_name&.to_s&.delete_prefix('rich_text_')&.to_sym || association_name
field field_name, as: :trix, **@field_options
end
end

def discover_tags
tags.each do |association_name, reflection|
tags.each_key do |association_name|
next unless column_in_scope?(association_name)

field_name = association_name&.to_s&.delete_suffix('_taggings').pluralize.to_sym || association_name
field field_name, as: :tags, **@field_options.merge(acts_as_taggable_on: field_name)
field tag_field_name(association_name), as: :tags, **@field_options.merge(acts_as_taggable_on: field_name)
end
end

def tag_field_name(association_name)
association_name&.to_s&.delete_suffix('_taggings')&.pluralize&.to_sym || association_name
end

def discover_attachments
attachment_associations.each do |association_name, reflection|
next unless column_in_scope?(association_name)
Expand Down

0 comments on commit 657c2da

Please sign in to comment.