Skip to content

Commit

Permalink
Further updates for rails 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpawlyn committed Aug 23, 2024
1 parent 1fa48c0 commit 6c58196
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/avo/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/avo/associations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/avo/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c58196

Please sign in to comment.