5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 03:36:22 +00:00

fix: brakeman

This commit is contained in:
f 2024-05-28 13:15:45 -03:00
parent 99310c56bb
commit 9c8ec08e73
No known key found for this signature in database

View file

@ -126,7 +126,7 @@ class PostsController < ApplicationController
@uuid = @post.uuid.value
@name = params.require(:name)
render "posts/#{params.require(:attribute)}_value", layout: false
render render_path_from_attribute, layout: false
else
headers['HX-Retarget'] = "##{params.require(:form)}"
headers['HX-Reswap'] = 'outerHTML'
@ -240,4 +240,13 @@ class PostsController < ApplicationController
headers['HX-Trigger'] = triggers.to_json if triggers.present?
end
# @return [String]
def render_path_from_attribute
case params.require(:attribute)
when 'new_has_many' then 'posts/new_has_many_value'
when 'new_belongs_to' then 'posts/new_belongs_to_value'
else 'nothing'
end
end
end