From c06723ee715512c2033c7786c48f15674585b56b Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 01:59:57 +0200 Subject: Stage 4: Rails 5.2 -> 6.1 on Ruby 2.7.2 - routing-filter 0.6.3 -> 0.7.0 (Rails 6.1 compatibility) - RSS named routes rss_xml/rss_rdf added - RouteWithParams workarounds: will_paginate_patch, content_path shim, safe_path helper - Paperclip removed, replaced with FileAttachment concern (preserves URL scheme) - Assets resource moved to /admin/assets (Sprockets middleware conflict) - ApplicationRecord base class added, all models migrated - Strong parameters added to Assets, Occurrences, Events, MenuItems controllers - update_attributes -> update throughout - render :nothing -> head :ok/:not_found throughout - language_selector rewritten (removes :overwrite_params) - Environment files updated for Rails 6.1 (eager_load, public_file_server, ActionMailer) - Arel::Visitors::DepthFirst and Integer/Float duration patches removed from test_helper - AssetsController tests added (10 tests covering upload, variants, destroy, auth) - ImageMagick geometry: 460x250! for headline crop (not # which is invalid in IM6) 129 runs, 311 assertions, 5 failures (all pre-existing), 0 errors --- app/controllers/menu_items_controller.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'app/controllers/menu_items_controller.rb') diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb index 4018693..1b1eb59 100644 --- a/app/controllers/menu_items_controller.rb +++ b/app/controllers/menu_items_controller.rb @@ -14,11 +14,11 @@ class MenuItemsController < ApplicationController end def new - @menu_item = MenuItem.new params[:menu_item] + @menu_item = MenuItem.new menu_item_params end def create - if MenuItem.create( params[:menu_item] ) + if MenuItem.create( menu_item_params ) redirect_to menu_items_path else render :new @@ -32,7 +32,7 @@ class MenuItemsController < ApplicationController def update @menu_item = MenuItem.find( params[:id] ) - if @menu_item.update_attributes( params[:menu_item] ) + if @menu_item.update( menu_item_params ) redirect_to menu_items_path else render :edit @@ -48,10 +48,15 @@ class MenuItemsController < ApplicationController def sort params[:menu_items].each_with_index do |item_id, index| menu_item = MenuItem.find(item_id) - menu_item.update_attributes(:position => index + 1) + menu_item.update(:position => index + 1) end - render :nothing => true + head :ok end + private + + def menu_item_params + params.require(:menu_item).permit(:node_id, :path, :position, :type, :type_id) + end end -- cgit v1.3