diff --git a/app/models/my_module_repository_row.rb b/app/models/my_module_repository_row.rb index e2eef2382..c28ce10a0 100644 --- a/app/models/my_module_repository_row.rb +++ b/app/models/my_module_repository_row.rb @@ -4,10 +4,12 @@ class MyModuleRepositoryRow < ApplicationRecord class_name: 'User', optional: true belongs_to :repository_row, + optional: true, + inverse_of: :my_module_repository_rows + belongs_to :my_module, optional: true, touch: true, inverse_of: :my_module_repository_rows - belongs_to :my_module, optional: true, inverse_of: :my_module_repository_rows validates :repository_row, :my_module, presence: true validates :repository_row, uniqueness: { scope: :my_module } diff --git a/app/models/repository_row.rb b/app/models/repository_row.rb index 17e9e2b06..4daa0aae3 100644 --- a/app/models/repository_row.rb +++ b/app/models/repository_row.rb @@ -1,7 +1,7 @@ class RepositoryRow < ApplicationRecord include SearchableModel - belongs_to :repository, touch: true, optional: true + belongs_to :repository, optional: true belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User', diff --git a/app/views/my_modules/_repositories_dropdown.html.erb b/app/views/my_modules/_repositories_dropdown.html.erb index 00146bb1f..46e4cbf3b 100644 --- a/app/views/my_modules/_repositories_dropdown.html.erb +++ b/app/views/my_modules/_repositories_dropdown.html.erb @@ -6,7 +6,7 @@ href="<%= repository_my_module_url(id: @my_module, repository_id: repository) %>" title="<%= repository.name %>"> <% if enable_counters %> - <% cache [current_user, repository] do %> + <% cache [repository, @my_module] do %> <%= truncate(repository.name) %> <%= "(#{@my_module.repository_rows_count(repository)})" %> <% end %>