From df043b939e4e802bcee7ef0c5cb78f114b05f6c4 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 5 Feb 2026 17:17:46 -0800 Subject: [PATCH] Support GET requests for /pets/load --- app/controllers/pets_controller.rb | 9 +++++---- app/helpers/application_helper.rb | 2 +- app/helpers/outfits_helper.rb | 4 ---- app/views/outfits/new.html.haml | 3 +-- config/routes.rb | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index 97b25329..ad9e5abf 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -34,9 +34,10 @@ class PetsController < ApplicationController end def destination - case (params[:destination] || params[:origin]) - when 'wardrobe' then wardrobe_path - else root_path + if request.get? + wardrobe_path + else + root_path end end @@ -59,7 +60,7 @@ class PetsController < ApplicationController path += "?name=#{params[:name]}" redirect_to path, :alert => options[:long_message] end - + format.json do render :json => options[:long_message], :status => options[:status] end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e357e6ba..6861211b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -167,7 +167,7 @@ module ApplicationHelper def origin_tag(value) hidden_field_tag 'origin', value, :id => nil end - + def open_graph(properties) if @open_graph @open_graph.merge! properties diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index a31d8587..6eca3717 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -1,8 +1,4 @@ module OutfitsHelper - def destination_tag(value) - hidden_field_tag 'destination', value, :id => nil - end - def latest_contribution_description(contribution) user = contribution.user contributed = contribution.contributed diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 6e21ad96..6a8d84e5 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -25,8 +25,7 @@ %h1= t 'app_name' %h2= t '.tagline' - = form_tag load_pet_path, method: 'POST', class: 'primary load-pet-to-wardrobe' do - = hidden_field_tag 'destination', 'wardrobe' + = form_tag load_pet_path, method: 'GET', class: 'primary load-pet-to-wardrobe' do %fieldset %legend= t '.load_pet' = pet_name_tag class: 'main-pet-name' diff --git a/config/routes.rb b/config/routes.rb index 89aebd8c..04e61f80 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,7 +46,7 @@ OpenneoImpressItems::Application.routes.draw do get '/alt-styles', to: redirect('/rainbow-pool/styles') # Loading and modeling pets! - post '/pets/load' => 'pets#load', :as => :load_pet + match '/pets/load' => 'pets#load', :as => :load_pet, via: [:get, :post] get '/modeling' => 'pets#bulk', :as => :bulk_pets # Contributions to our modeling database!