From 23892296dab50b10b2a029b54093ba77d2fe5e86 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 7 Apr 2025 14:06:56 +0200 Subject: [PATCH] Move readings under bubbles and out of double nesting --- app/controllers/{ => bubbles}/readings_controller.rb | 2 +- app/views/bubbles/show.html.erb | 2 +- config/routes.rb | 5 +---- test/controllers/{ => bubbles}/readings_controller_test.rb | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) rename app/controllers/{ => bubbles}/readings_controller.rb (83%) rename test/controllers/{ => bubbles}/readings_controller_test.rb (59%) diff --git a/app/controllers/readings_controller.rb b/app/controllers/bubbles/readings_controller.rb similarity index 83% rename from app/controllers/readings_controller.rb rename to app/controllers/bubbles/readings_controller.rb index fe0761831..9f99c456d 100644 --- a/app/controllers/readings_controller.rb +++ b/app/controllers/bubbles/readings_controller.rb @@ -1,4 +1,4 @@ -class ReadingsController < ApplicationController +class Bubbles::ReadingsController < ApplicationController include BubbleScoped def create diff --git a/app/views/bubbles/show.html.erb b/app/views/bubbles/show.html.erb index fae887838..ec41a139d 100644 --- a/app/views/bubbles/show.html.erb +++ b/app/views/bubbles/show.html.erb @@ -51,7 +51,7 @@ <% end %> -
+
" style="--bubble-color: <%= @bubble.color %>;"> <%= render "bubbles/cards/perma", bubble: @bubble %> diff --git a/config/routes.rb b/config/routes.rb index 11f46b500..91b6559c8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,6 +15,7 @@ Rails.application.routes.draw do resource :pin resource :pop resource :publish + resource :reading resource :recover resource :watch @@ -50,10 +51,6 @@ Rails.application.routes.draw do resources :comments do resources :reactions, module: :comments end - resource :readings, only: :create - - scope module: :bubbles do - end end end diff --git a/test/controllers/readings_controller_test.rb b/test/controllers/bubbles/readings_controller_test.rb similarity index 59% rename from test/controllers/readings_controller_test.rb rename to test/controllers/bubbles/readings_controller_test.rb index 7d124736d..3cc682d83 100644 --- a/test/controllers/readings_controller_test.rb +++ b/test/controllers/bubbles/readings_controller_test.rb @@ -1,13 +1,13 @@ require "test_helper" -class ReadingsControllerTest < ActionDispatch::IntegrationTest +class Bubbles::ReadingsControllerTest < ActionDispatch::IntegrationTest setup do sign_in_as :kevin end test "index" do assert_changes -> { notifications(:logo_published_kevin).reload.read? }, from: false, to: true do - post bucket_bubble_readings_url(bubbles(:logo).bucket, bubbles(:logo)), as: :turbo_stream + post bubble_reading_url(bubbles(:logo)), as: :turbo_stream end assert_response :success