From 68f5f71701f53dffba53b3390b8e01cc23cc3d9c Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 27 Aug 2021 00:40:47 -0400 Subject: [PATCH] switch to turbo --- Gemfile | 6 +++--- Gemfile.lock | 9 +++++---- app/controllers/pages_controller.rb | 4 ++-- app/javascript/packs/application.js | 3 ++- app/views/machines/index.html.erb | 2 +- app/views/players/index.html.erb | 2 +- config/cable.yml | 3 ++- package.json | 2 +- yarn.lock | 13 +++++++++++++ 9 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index d20ac2f..8fd2931 100644 --- a/Gemfile +++ b/Gemfile @@ -13,12 +13,12 @@ gem 'puma', '~> 5.4' gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.4' -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' +# https://github.com/hotwired/turbo-rails +gem 'turbo-rails' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.11' # Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' +gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' diff --git a/Gemfile.lock b/Gemfile.lock index 3e9b710..171efda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,6 +147,7 @@ GEM rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) + redis (4.4.0) regexp_parser (2.1.1) rubyzip (2.3.2) sass-rails (6.0.0) @@ -177,9 +178,8 @@ GEM sqlite3 (1.4.2) thor (1.1.0) tilt (2.0.10) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + turbo-rails (0.7.4) + rails (>= 6.0.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) web-console (4.1.0) @@ -211,12 +211,13 @@ DEPENDENCIES pry-rails puma (~> 5.4) rails (~> 6.1.4, >= 6.0.3.7) + redis (~> 4.0) sass-rails (>= 6) selenium-webdriver spring spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.4) - turbolinks (~> 5) + turbo-rails tzinfo-data web-console (>= 4.1.0) webpacker (~> 5.4) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 2c454f9..923edf2 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -6,14 +6,14 @@ class PagesController < ApplicationController def teampicker @groups = maketeams - @machines = Machine.limit(@groups.count).order(Arel.sql("RANDOM()")) + @machines = Machine.limit(@groups.size).order(Arel.sql("RANDOM()")) end private def maketeams r = Player.where("strikes < 4").order(Arel.sql("RANDOM()")).to_a - groups = case r.count + groups = case r.size when 5 [r.shift(3), r.shift(2)] when 6 diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9cd55d4..9e9feba 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -4,7 +4,6 @@ // that code so it'll be compiled. require("@rails/ujs").start() -require("turbolinks").start() require("@rails/activestorage").start() require("channels") @@ -15,3 +14,5 @@ require("channels") // // const images = require.context('../images', true) // const imagePath = (name) => images(name, true) + +import "@hotwired/turbo-rails" diff --git a/app/views/machines/index.html.erb b/app/views/machines/index.html.erb index 21717b9..33e279b 100644 --- a/app/views/machines/index.html.erb +++ b/app/views/machines/index.html.erb @@ -1,6 +1,6 @@

Pinball Machines

-

<%= @machines.count %> available machines

+

<%= @machines.size %> available machines