mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-30 19:48:18 +08:00
Fix issue with caching in inventories dropdown [SCI-2776]
This commit is contained in:
parent
88cea198f0
commit
e62e1873b0
3 changed files with 5 additions and 3 deletions
|
@ -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 }
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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) %>
|
||||
<span class="assigned-items-counter"><%= "(#{@my_module.repository_rows_count(repository)})" %></span>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue