Skip to content

Commit e810e9f

Browse files
authored
fix: has many relation link_to has wrong path (#169)
1 parent cbd9c93 commit e810e9f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

app/frontend/js/mixins/deals-with-has-many-relations.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export default {
66
return null
77
},
88
resourcePath() {
9+
if (this.resource && this.resource.path) {
10+
return this.resource.path
11+
}
12+
913
if (this.field && this.field.path) {
1014
return this.field.path
1115
}

lib/avo/app/resource.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def hydrate_resource(model:, resource:, view: :index, user:)
2121
resource_name_singular: resource.resource_name_singular,
2222
resource_name_plural: resource.resource_name_plural,
2323
title: model[resource.title],
24+
path: resource.url,
2425
fields: [],
2526
grid_fields: {},
2627
panels: [{

lib/avo/engine.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ class Engine < ::Rails::Engine
3030

3131
# What to do on file change
3232
config.to_prepare do
33-
Dir.glob(avo_root_path + '/lib/avo/app/**/*.rb'.to_s).each { |c| require(c) }
33+
Dir.glob(avo_root_path + '/lib/avo/app/**/*.rb'.to_s).each { |c| load c }
3434
end
3535
end
3636

3737
if Rails.env.production?
38-
Dir.glob(avo_root_path + '/lib/avo/app/**/*.rb'.to_s).each { |c| require(c) }
38+
Dir.glob(avo_root_path + '/lib/avo/app/**/*.rb'.to_s).each { |c| require c }
3939

4040
Avo::App.boot
4141
end

0 commit comments

Comments
 (0)