From 0e37ee36cf89d2784df2d17b0a3a3a28276f0c7d Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 21 Jul 2018 18:48:06 -0500 Subject: [PATCH] :((((((((((((((( --- app/models/concerns/has_content_groupers.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/has_content_groupers.rb b/app/models/concerns/has_content_groupers.rb index 94222a43..c667ce6b 100644 --- a/app/models/concerns/has_content_groupers.rb +++ b/app/models/concerns/has_content_groupers.rb @@ -12,12 +12,22 @@ module HasContentGroupers connecting_class = with.to_s.singularize.camelize.constantize connecting_class_name = with + if relation == :deity_characters + # sadface, SADFACE + singularized_relation = :deity + end + # Fetch the connecting class's through class (e.g. Character for sibling_id). # If there isn't one defined, it means it already maps to a model (e.g. race_id), # so we can use the name as the class as well. belongs_to_relations = connecting_class.reflect_on_all_associations(:belongs_to) through_relation = belongs_to_relations.detect do |relation| # sibling - relation.name.to_s == singularized_relation + # sadface + if relation.name == :deity_character && singularized_relation == :deity + true + else + relation.name.to_s == singularized_relation + end end if through_relation.options.key?(:class_name) through_relation_class = through_relation.options[:class_name] # Character