diff --git a/app/controllers/avo/application_controller.rb b/app/controllers/avo/application_controller.rb index 7d7431134f..b3f2823692 100644 --- a/app/controllers/avo/application_controller.rb +++ b/app/controllers/avo/application_controller.rb @@ -226,7 +226,7 @@ def related_resource return field.use_resource if field&.use_resource.present? - reflection = @model._reflections[params[:related_name]] + reflection = @model.class.reflections[params[:related_name]] reflected_model = reflection.klass diff --git a/app/controllers/avo/associations_controller.rb b/app/controllers/avo/associations_controller.rb index 698b9a2597..b96fb19c72 100644 --- a/app/controllers/avo/associations_controller.rb +++ b/app/controllers/avo/associations_controller.rb @@ -101,7 +101,7 @@ def order private def set_reflection - @reflection = @model._reflections[params[:related_name].to_s] + @reflection = @model.class.reflections[params[:related_name].to_s] end def set_attachment_class @@ -127,7 +127,7 @@ def attachment_id end def reflection_class - reflection = @model._reflections[params[:related_name]] + reflection = @model.class.reflections[params[:related_name]] klass = reflection.class.name.demodulize.to_s klass = reflection.through_reflection.class.name.demodulize.to_s if klass == "ThroughReflection" diff --git a/app/controllers/avo/base_controller.rb b/app/controllers/avo/base_controller.rb index 4e26e87171..f5ff7a9fa5 100644 --- a/app/controllers/avo/base_controller.rb +++ b/app/controllers/avo/base_controller.rb @@ -134,7 +134,7 @@ def create # This means that the record has been created through another parent record and we need to attach it somehow. if params[:via_resource_id].present? && params[:via_belongs_to_resource_class].nil? - @reflection = @model._reflections[params[:via_relation]] + @reflection = @model.class.reflections[params[:via_relation]] # Figure out what kind of association does the record have with the parent record # Fills in the required infor for belongs_to and has_many