<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jairo Andrés Orjuela</title>
    <description>The latest articles on DEV Community by Jairo Andrés Orjuela (@jairomanorjuela).</description>
    <link>https://dev.to/jairomanorjuela</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F637681%2Ff585d2f9-11bb-493b-94d0-d708522e8c80.jpeg</url>
      <title>DEV Community: Jairo Andrés Orjuela</title>
      <link>https://dev.to/jairomanorjuela</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jairomanorjuela"/>
    <language>en</language>
    <item>
      <title>Upgrade from Rails 6.1.7 to Rails 7.0</title>
      <dc:creator>Jairo Andrés Orjuela</dc:creator>
      <pubDate>Tue, 31 Jan 2023 23:44:39 +0000</pubDate>
      <link>https://dev.to/jairomanorjuela/upgrade-from-rails-617-to-rails-70-27j2</link>
      <guid>https://dev.to/jairomanorjuela/upgrade-from-rails-617-to-rails-70-27j2</guid>
      <description>&lt;p&gt;Rails Upgrade&lt;/p&gt;

&lt;p&gt;Upgrade from Rails 6.1.7 to Rails 7.0 in an API type application.&lt;/p&gt;

&lt;p&gt;Before the upgrade the specs are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have a Mac M1 MacOs ventura&lt;/li&gt;
&lt;li&gt;Rails 6.1.7&lt;/li&gt;
&lt;li&gt;Ruby 2.7.3&lt;/li&gt;
&lt;li&gt;PostgreSQL 13.0 client for the mac
&lt;/li&gt;
&lt;li&gt;Redis server 6.2.4&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step by step upgrade:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There is a recommendation regarding not upgrading from a very old version to a very recent one, for example, it is not recommended to upgrade from Rails 5 to Rails 7, in this case it does not apply, as we are moving from 6.1 to 7 which is fine.&lt;/li&gt;
&lt;li&gt;Copy and paste our Gemfile.lock into &lt;a href="https://railsbump.org/"&gt;RailsBumb&lt;/a&gt; so we can check which of our gems are going to generate errors or problems.&lt;/li&gt;
&lt;li&gt;Use the gem "next_rails" to check which gems we need to update, when we have it installed we will just do a &lt;code&gt;bundle_report compatibility --rails-version=desired_version&lt;/code&gt;, after this we can update the gems that appear in the report.&lt;/li&gt;
&lt;li&gt;Updating gems:

&lt;ul&gt;
&lt;li&gt;If the report asks us to update gems that are part of Rails such as &lt;code&gt;ActionMailer&lt;/code&gt; or &lt;code&gt;ActionText&lt;/code&gt; these will be updated with the version change to Rails 7. If the gems are installed by us, obviously we must do the update.&lt;/li&gt;
&lt;li&gt;It is not advisable to have a fixed version of a gem in our &lt;code&gt;Gemfile&lt;/code&gt; so it is a good time to remove that.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;After updating the gems we can now in our &lt;code&gt;Gemfile&lt;/code&gt; update the Rails version and run &lt;code&gt;bundle update&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When the update is done the first thing to do is to change the &lt;code&gt;load_defaults&lt;/code&gt; to Rails 7 in our &lt;code&gt;config/application.rb&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;In my case I use &lt;code&gt;Spring&lt;/code&gt; this gem is on its 2.1.1 version for some reason &lt;code&gt;next-rails&lt;/code&gt; didn't take it into account, but it should be updated to a &lt;code&gt;3X&lt;/code&gt; version.

&lt;ul&gt;
&lt;li&gt;When I tried to update the gem it told me that I could not because it was locked, for this what I did was to delete my Gemfile.lock.&lt;/li&gt;
&lt;li&gt;Then in &lt;code&gt;config/environments/test.rb&lt;/code&gt; I left it set to &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Configure &lt;code&gt;Zeitwerk&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;Zeitwerk is the only way in Rails 7 to safely load files and avoid overuse of &lt;code&gt;require&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;As you have already made the switch to Rails 7 in the application in &lt;code&gt;config/application.rb&lt;/code&gt; you should remove the &lt;code&gt;config.autoloader&lt;/code&gt; line.&lt;/li&gt;
&lt;li&gt;Check if everything is already running fine with &lt;code&gt;bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'&lt;/code&gt; should return &lt;code&gt;true&lt;/code&gt; or the respective warnings.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Encryption

&lt;ul&gt;
&lt;li&gt;At this point, when starting the server I was getting an &lt;code&gt;ActiveSupport::MessageEncryptor::InvalidMessage&lt;/code&gt; error because of the encryption.&lt;/li&gt;
&lt;li&gt;In the API the attributes are encrypted following this &lt;a href="https://pawelurbanek.com/rails-secure-encrypt-decrypt"&gt;tutorial&lt;/a&gt;, but when updating Rails the encryption changes, because Rails 7 uses SHA256 while in the previous versions SHA1 is used, but this protocol is obsolete, to solve this you must specify to continue encrypting with SHA1 while then the change is made to use the encrypted attributes of Rails 7, to solve this it worked for me to add the &lt;code&gt;hash_digest_class&lt;/code&gt; like this:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EncryptionService&lt;/span&gt;
  &lt;span class="no"&gt;KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;KeyGenerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:secret_key_base&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="ss"&gt;hash_digest_class: &lt;/span&gt;&lt;span class="no"&gt;OpenSSL&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Digest&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;SHA1&lt;/span&gt;
  &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;generate_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:ENCRYPTION_SERVICE_SALT&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MessageEncryptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;key_len&lt;/span&gt;
  &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;freeze&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When running the tests I found the error &lt;code&gt;RuntimeError: Foreign key violations found in your fixture data&lt;/code&gt;, this is because in previous versions you could have &lt;code&gt;fixtures&lt;/code&gt; with a &lt;code&gt;missing association&lt;/code&gt;, this will no longer be possible in Rails 7.

&lt;ul&gt;
&lt;li&gt;One option is in &lt;code&gt;application.rb&lt;/code&gt; add the line &lt;code&gt;config.active_record.verify_foreign_keys_for_fixtures = false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The other option is to fix the errors in the fixtures (which is recommended), to detect which tables we have wrong, first we reset and load the test database and then enter in the console like this:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAILS_ENV=test bin/rails db:reset
RAILS_ENV=test bin/rails db:fixtures:load
RAILS_ENV=test bin/rails c 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then we run this query to identify if there are tables that are missing an association so we can correct the &lt;code&gt;fixtures&lt;/code&gt; and the error will be fixed:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ActiveRecord::Base.connection.execute(&amp;lt;&amp;lt;~SQL)
  do $$$
    declare r record;
  BEGIN
  FOR r IN (
    SELECT FORMAT(
      'UPDATE pg_constraint SET convalidated=false WHERE conname = ''%I''; ALTER TABLE %I VALIDATE CONSTRAINT %I;',
      constraint_name,
      table_name,
      constraint_name
    ) AS constraint_check
    FROM information_schema.table_constraints WHERE constraint_type = 'FOREIGN KEY'
  )
    LOOP
      EXECUTE (r.constraint_check);
    END LOOP;
  END;
  $$;
SQL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The following error to be corrected was &lt;code&gt;ActionDispatch::Request::Session::DisabledSessionError: Your application has sessions disabled. To write to the session you must first configure a session store&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;config/application.rb&lt;/code&gt;, I had the line &lt;code&gt;config.middleware.use ActionDispatch::Cookies&lt;/code&gt; to solve this solution from this &lt;a href="https://github.com/waiting-for-dev/devise-jwt/issues/235"&gt;thread of Github&lt;/a&gt; worked for me.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9bntCmAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vp4io2vzxb010h89yfnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9bntCmAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vp4io2vzxb010h89yfnn.png" alt="Github thread" width="880" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was the whole process in my case. The support guides and documentation for this update were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/fastruby/next_rails"&gt;Next Rails&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fastruby.io/blog/rails/upgrades/upgrade-rails-6-1-to-7-0.html"&gt;Documentación FastRuby.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0"&gt;Guías de Rails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://edgeguides.rubyonrails.org/7_0_release_notes.html"&gt;Principales cambios de Rails 7&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html"&gt;Cambio a Zeitwerk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/cedarcode/understanding-zeitwerk-in-rails-6-f168a9f09a1f"&gt;Más de Zeitwerk &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Update Rails 6.1 a Rails 7</title>
      <dc:creator>Jairo Andrés Orjuela</dc:creator>
      <pubDate>Tue, 31 Jan 2023 23:18:15 +0000</pubDate>
      <link>https://dev.to/jairomanorjuela/rails-61-a-rails-7-4i4l</link>
      <guid>https://dev.to/jairomanorjuela/rails-61-a-rails-7-4i4l</guid>
      <description>&lt;p&gt;Rails Upgrade&lt;/p&gt;

&lt;p&gt;Actualización de Rails 6.1.7 a Rails 7.0 en una aplicación tipo API.&lt;/p&gt;

&lt;p&gt;Antes de la actualización las especificaciones son:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tengo un Mac M1 MacOs ventura&lt;/li&gt;
&lt;li&gt;Rails 6.1.7&lt;/li&gt;
&lt;li&gt;Ruby 2.7.3&lt;/li&gt;
&lt;li&gt;Cliente para el mac PostgreSQL 13.0
&lt;/li&gt;
&lt;li&gt;Redis server 6.2.4&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Paso a paso de la actualización:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hay una recomendación respecto a no actualizar de una versión muy antigua a una muy reciente, por ejemplo, no es recomendable actualizar de Rails 5 a Rails 7, en este caso no aplica, ya que estamos pasando de 6.1 a 7 lo cual está bien.&lt;/li&gt;
&lt;li&gt;Copiar y pegar nuestro Gemfile.lock en &lt;a href="https://railsbump.org/"&gt;RailsBumb&lt;/a&gt; para poder revisar cuáles de nuestras gemas nos van a generar errores o problemas.&lt;/li&gt;
&lt;li&gt;Usar la gema “next_rails” para revisar cuáles gemas tenemos que actualizar, cuando ya la tengamos instalada solo haremos un &lt;code&gt;bundle_report compatibility --rails-version=version_deseada&lt;/code&gt;, después de esto ya podemos actualizar las gemas que nos aparezcan en el reporte.&lt;/li&gt;
&lt;li&gt;Actualización de gemas:

&lt;ul&gt;
&lt;li&gt;Si el reporte nos pide actualizar gemas que hacen parte de Rails como &lt;code&gt;ActionMailer&lt;/code&gt; o &lt;code&gt;ActionText&lt;/code&gt; estas se van a actualizar con el cambio de versión a Rails 7. Si las gemas son instaladas por nosotros, obviamente debemos hacer la actualización.&lt;/li&gt;
&lt;li&gt;No es aconsejable tener una versión fija de una gema en nuestro &lt;code&gt;Gemfile&lt;/code&gt; así que es un buen momento para ir eliminando eso.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Luego de actualizar las gemas ahora podemos en nuestro &lt;code&gt;Gemfile&lt;/code&gt; actualizar la versión de Rails y correr &lt;code&gt;bundle update&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Cuando se haga la actualización lo primero es cambiar el &lt;code&gt;load_defaults&lt;/code&gt; a Rails 7 en nuestro archivo &lt;code&gt;config/application.rb&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;En mi caso uso &lt;code&gt;Spring&lt;/code&gt; esta gema está en su versión 2.1.1 por alguna razón &lt;code&gt;next-rails&lt;/code&gt; no la tuvo en cuenta, pero debe ser actualizada a una versión &lt;code&gt;3X&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;Cuando intenté actualizar la gema me decía que no podía porque estaba bloqueada, para esto lo que hice fue eliminar mi Gemfile.lock.&lt;/li&gt;
&lt;li&gt;Luego en &lt;code&gt;config/environments/test.rb&lt;/code&gt; lo dejé configurado en &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Configurar &lt;code&gt;Zeitwerk&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Zeitwerk&lt;/code&gt; es la única forma en Rails 7 para cargar de forma segura archivos y evitar el uso excesivo de &lt;code&gt;require&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Como ya se hizo el cambio a Rails 7 en la aplicación en &lt;code&gt;config/application.rb&lt;/code&gt; se debe eliminar la línea &lt;code&gt;config.autoloader&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Verificar si ya está corriendo todo bien con &lt;code&gt;bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'&lt;/code&gt; debe retornar &lt;code&gt;true&lt;/code&gt; o en su defecto los respectivos warnings.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Encriptación

&lt;ul&gt;
&lt;li&gt;En este punto, al iniciar el server estaba obteniendo un error &lt;code&gt;ActiveSupport::MessageEncryptor::InvalidMessage&lt;/code&gt; esto es por la encriptación.&lt;/li&gt;
&lt;li&gt;En la API se encripta los atributos siguiendo este &lt;a href="https://pawelurbanek.com/rails-secure-encrypt-decrypt"&gt;tutorial&lt;/a&gt;, pero al actualizar Rails la encriptación cambia, porque Rails 7 usa SHA256 mientras que en las versiones anteriores se usa SHA1, pero este protocolo está obsoleto, para solucionar esto se debe especificar que siga encriptando con SHA1 mientras que luego se hace la el cambio para poder usar los atributos encriptados de Rails 7, para solucionarlo me funcionó agregar el &lt;code&gt;hash_digest_class&lt;/code&gt; así:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EncryptionService&lt;/span&gt;
  &lt;span class="no"&gt;KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;KeyGenerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:secret_key_base&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="ss"&gt;hash_digest_class: &lt;/span&gt;&lt;span class="no"&gt;OpenSSL&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Digest&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;SHA1&lt;/span&gt;
  &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;generate_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:ENCRYPTION_SERVICE_SALT&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MessageEncryptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;key_len&lt;/span&gt;
  &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;freeze&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Al correr los test encontré el error &lt;code&gt;RuntimeError: Foreign key violations found in your fixture data&lt;/code&gt;, esto se debe a que en versiones anteriores se podían tener &lt;code&gt;fixtures&lt;/code&gt; con una &lt;code&gt;missing association&lt;/code&gt;, esto ya no será posible en Rails 7.

&lt;ul&gt;
&lt;li&gt;Una opción es en &lt;code&gt;application.rb&lt;/code&gt; agregar la línea &lt;code&gt;config.active_record.verify_foreign_keys_for_fixtures = false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;La otra opción es arreglar los errores en los fixtures(Lo cual es lo recomendado), para detectar qué tablas tenemos mal, primero reseteamos y cargamos la base datos de test para luego entrar en la consola así:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAILS_ENV=test bin/rails db:reset
RAILS_ENV=test bin/rails db:fixtures:load
RAILS_ENV=test bin/rails c 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Luego corremos esta consulta para identificar si hay tablas que les falta una asociación para poder corregir los &lt;code&gt;fixtures&lt;/code&gt; y ya con esto el error se solucionará:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ActiveRecord::Base.connection.execute(&amp;lt;&amp;lt;~SQL)
  do $$
    declare r record;
  BEGIN
  FOR r IN (
    SELECT FORMAT(
      'UPDATE pg_constraint SET convalidated=false WHERE conname = ''%I''; ALTER TABLE %I VALIDATE CONSTRAINT %I;',
      constraint_name,
      table_name,
      constraint_name
    ) AS constraint_check
    FROM information_schema.table_constraints WHERE constraint_type = 'FOREIGN KEY'
  )
    LOOP
      EXECUTE (r.constraint_check);
    END LOOP;
  END;
  $$;
SQL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;El siguiente error a corregir fue &lt;code&gt;ActionDispatch::Request::Session::DisabledSessionError: Your application has sessions disabled. To write to the session you must first configure a session store&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;En &lt;code&gt;config/application.rb&lt;/code&gt; tenía la línea &lt;code&gt;config.middleware.use ActionDispatch::Cookies&lt;/code&gt; para solucionar me funcionó esta respuesta de este &lt;a href="https://github.com/waiting-for-dev/devise-jwt/issues/235"&gt;hilo&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v-w_yvkc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yt996664q7veabj50fv1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v-w_yvkc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yt996664q7veabj50fv1.png" alt="Github Response" width="880" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Este fue todo el proceso en mi caso, las guías y documentos de apoyo para esta actualización fueron:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/fastruby/next_rails"&gt;Next Rails&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fastruby.io/blog/rails/upgrades/upgrade-rails-6-1-to-7-0.html"&gt;Documentación FastRuby.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0"&gt;Guías de Rails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://edgeguides.rubyonrails.org/7_0_release_notes.html"&gt;Principales cambios de Rails 7&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html"&gt;Cambio a Zeitwerk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/cedarcode/understanding-zeitwerk-in-rails-6-f168a9f09a1f"&gt;Más de Zeitwerk &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
