title: Rails 7 and Turbo
body: <pre class="lang-ruby prettyprint-override"><code> # GET /rides or /rides.json
    def index
      @location = current_user.currently_at
      @location ||= 'Georgetown'
      @pagy, @rides = pagy(Ride.where(from: @location)
      .where(status: 'open')
      .where.not(id: current_user.driver.offers.select(:ride_id)).order(created_at: :asc), items: 7)
      @offer = Offer.new
    end
  
  #ndex.html.erb
  &lt;div class=&quot;w-full px-2 mb-8&quot;&gt;
    &lt;% if notice.present? %&gt;
      &lt;p class=&quot;py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block&quot; id=&quot;notice&quot;&gt;&lt;%= notice %&gt;&lt;/p&gt;
    &lt;% end %&gt;
    &lt;h1 class=&quot;center-text text-xl&quot;&gt;Rides in &lt;%=@location%&gt;&lt;/h1&gt;
    &lt;span class=&quot;mb-2 inline-flex justify-left px-2 py-1 text-xs leading-none text-white bg-blue-700 rounded-lg &quot;&gt;&lt;%=@rides.count%&gt; rides available&lt;/span&gt;
    &lt;% if current_user.driver.status == 'working' %&gt;
      &lt;div&gt;
        &lt;h4&gt;You currently have one job open. Complete it to see more jobs.
        &lt;/h4&gt;
      &lt;/div&gt;
    &lt;% else %&gt;
      &lt;div id=&quot;locations&quot; class=&quot;min-w-full&quot;&gt;
        &lt;% if @pagy.count &gt; 7 %&gt;
          &lt;div class=&quot; flex flex-col justify-center mx-4 text-xs text-gray-900 mt-1 mb-3 text-center&quot;&gt;
            &lt;%== pagy_info(@pagy) %&gt;
            &lt;div class=&quot;text-xs flex justify-center&quot;&gt;
              &lt;%== pagy_combo_nav_js(@pagy) %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
        &lt;%= render @rides %&gt;
        &lt;% if @pagy.count &gt; 7 %&gt;
          &lt;div class=&quot; flex flex-col justify-center mx-4 text-xs text-gray-900 mt-1 mb-16 text-center&quot;&gt;
            &lt;%== pagy_info(@pagy) %&gt;
            &lt;div class=&quot;text-xs flex justify-center&quot;&gt;
              &lt;%== pagy_combo_nav_js(@pagy) %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  
  #_ride.html.erb
  &lt;div class = &quot;pb-2 px-2 bg-white  rounded-2xl&quot; id=&quot;&lt;%= dom_id ride %&gt;&quot;&gt;
    &lt;div class=&quot;flex flex-row-reverse &quot;&gt;
      &lt;span class=&quot;mb-0 inline-flex justify-right px-2  mt-2 text-xs leading-none text-black bg-emerald-300 rounded-lg py-1 &quot;&gt;&lt;%=time_ago_in_words(ride.updated_at, include_seconds: true)%&gt; ago&lt;/span&gt;
    &lt;/div&gt;
    &lt;div class = &quot;flex flex-col px-1&quot;&gt;
      &lt;p class = &quot;my-block text-lg&quot;&gt;
        &lt;strong&gt;Going to:&lt;/strong&gt;
        &lt;%= ride.to %&gt;
      &lt;/p&gt;
      &lt;div class = &quot;flex text-xs&quot;&gt;
        &lt;p class = &quot;my-block text-xs  &quot;&gt;
          &lt;strong&gt;Pickup location:&lt;/strong&gt;
          &lt;%= ride.directions_from  %&gt;
        &lt;/p&gt;
        &lt;p class = &quot;my-block text-xs ml-2&quot;&gt;
          &lt;strong&gt;Dropoff location:&lt;/strong&gt;
          &lt;%= ride.directions_to %&gt;
        &lt;/p&gt;
      &lt;/div&gt;
      &lt;% if action_name != &quot;show&quot; %&gt;
        &lt;div class=&quot;&quot;&gt;
          &lt;%= render '/offers/form', offer: @offer, ride: ride%&gt;
        &lt;/div&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;br&gt;
  </code></pre>
  <p>Given the code above, Id like to create a liveview such that anytime a ride from @rides in the index control changes, so does the view.</p>
  <p>What would be the modifications necessary in the controller and view are &quot;linked&quot;</p>
  <p>Conceptually I cant wrap my mind around how turbstreams tie together with the logic, views and partials</p>