Skip to content

Commit

Permalink
fix: has many relation link_to has wrong path (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Oct 26, 2020
1 parent cbd9c93 commit e810e9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/frontend/js/mixins/deals-with-has-many-relations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export default {
return null
},
resourcePath() {
if (this.resource && this.resource.path) {
return this.resource.path
}

if (this.field && this.field.path) {
return this.field.path
}
Expand Down
1 change: 1 addition & 0 deletions lib/avo/app/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def hydrate_resource(model:, resource:, view: :index, user:)
resource_name_singular: resource.resource_name_singular,
resource_name_plural: resource.resource_name_plural,
title: model[resource.title],
path: resource.url,
fields: [],
grid_fields: {},
panels: [{
Expand Down
4 changes: 2 additions & 2 deletions lib/avo/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class Engine < ::Rails::Engine

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

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

Avo::App.boot
end
Expand Down

0 comments on commit e810e9f

Please sign in to comment.