use Rails.application.credentials.secret_key_base
credentials
check for details There are two ways to access secret_key_base:
you can change Rails.application.credentials.secret_key_base by rails credentials:edit.