1
0
Fork 0

Parse params

This commit is contained in:
Alex Kotov 2023-02-05 05:25:23 +04:00
parent 6a50234e04
commit f084987d41
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 6 additions and 1 deletions

View File

@ -18,7 +18,12 @@ end
get '/examples' do
$DB_POOL.with do |db_conn|
ids = params[:ids]
ids =
case params[:ids]
when Array then params[:ids].map { |id| Integer id }
when String then params[:ids].split(',').map { |id| Integer id }
else raise 'Invalid param "ids"'
end
examples = db_conn.exec_params(
(