mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 03:26:22 +00:00
fix: brakeman
This commit is contained in:
parent
99310c56bb
commit
9c8ec08e73
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue