diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index 1118894e18..3a67beab55 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -8,7 +8,7 @@ class SamplesController < ApplicationController before_action :samples_enabled? before_action :find_index_assets, only: :index before_action :find_and_authorize_requested_item, except: [:index, :new, :create, :preview] - before_action :check_if_locked_sample_type, only: [:edit, :new] + before_action :check_if_locked_sample_type, only: %i[edit new create update] before_action :templates_enabled?, only: [:query, :query_form] before_action :auth_to_create, only: %i[new create batch_create] diff --git a/app/models/sample.rb b/app/models/sample.rb index 464d37c008..e07e179794 100644 --- a/app/models/sample.rb +++ b/app/models/sample.rb @@ -40,7 +40,7 @@ class Sample < ApplicationRecord validates_with SampleAttributeValidator validate :validate_added_linked_sample_permissions - validate :check_if_locked_sample_type, on: :create + validate :check_if_locked_sample_type, on: %i[create update] before_validation :set_title_to_title_attribute_value before_validation :update_sample_resource_links diff --git a/test/functional/sample_types_controller_test.rb b/test/functional/sample_types_controller_test.rb index 4bc60b2544..2c7ca980c0 100644 --- a/test/functional/sample_types_controller_test.rb +++ b/test/functional/sample_types_controller_test.rb @@ -5,7 +5,6 @@ class SampleTypesControllerTest < ActionController::TestCase include AuthenticatedTestHelper setup do - Rails.cache.clear FactoryBot.create(:person) # to prevent person being first person and therefore admin @person = FactoryBot.create(:project_administrator) @project = @person.projects.first