5,360 questions
0
votes
1
answer
35
views
Sinatra app Content Security Policy nonce for inline script not working
In my very simple Sinatra app I have a home page on which there is form which needs to be submitted through AJAX and the HAML template needs to execute some JS code. And I need to set the Content-...
0
votes
0
answers
43
views
Sinatra (erb) - construct link from select choice
I have a small sinatra app, which I am using primarily over REST (so far) to run and automate some data processing tasks (register new data sets, and then assign processing tasks etc). Anyway, to help ...
0
votes
0
answers
131
views
VSCode Ruby Debug Configuration for a Ruby Sinatra app
Problem
I have a ruby sinatra app running in docker.
I would like to interactively debug this app (in VSCode).
Existing App
docker-compose.yml
my_sinatra_app:
container_name: my_sinatra_app
...
0
votes
1
answer
74
views
How to see absolute paths in swagger for sinatra (rswag)
Setup
# Gemfile
gem 'rspec-swag'
# config.ru
map '/orders' do
run Web::OrdersApp
end
map '/admin/orders' do
run Web::AdminOrdersApp
end
# rspec
...
0
votes
0
answers
62
views
I am yielding to an ERB file, but it is rendering in plain text and not HTML. Why?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0&...
0
votes
0
answers
92
views
popen3 not capturing full output
I have a bash script that takes several seconds to finish running. Because of this, popen3 seems to be cutting off the output, simply capturing the beginning echo statements in my bash script. How do ...
0
votes
0
answers
69
views
Making sense of Ruby server on Cpanel
I have set up a Ruby 3.2 app with cPanel on a hosted system.
The rubyhome directory is ruby.myDomain.co.uk. It contains config.ru and app.rb and no html files.
A subdirectory of rubyhome is /public ...
-2
votes
1
answer
80
views
How to pass raw binary data to the put() method of rack/test?
I'm doing this:
require 'rack/test'
data = # some binary data, for example, ZIP archive
put('/foo', data, 'content_type' => 'application/octet-stream')
Works just fine, until I put the % symbol ...
0
votes
2
answers
68
views
How can Sinatra be configured to run within a virtual sub-directory of a reverse proxy?
I have an app in Sinatra that accepts requests at the root and with a name using:
get '/'
'Root page'
end
get '/:name'
#Some code here
end
When hosting the application behind a reverse-proxy ...
1
vote
1
answer
86
views
How to create a HAML6 helper that renders and returns at the same time?
I'm trying to design a helper for HAML, which would work like this:
%table
- tabular(items) do |i|
%tr
%td
= i[:title]
I expect it to render the following HTML:
<table>
<tr>&...
1
vote
1
answer
187
views
Issue with Psych::DisallowedClass Exception when using reify in PaperTrail with Sinatra
I am working on a Ruby project using Sinatra version 3.0.6 and Ruby version 3.0.0. I am using the PaperTrail gem (version 15.1.0) to track changes in my models for auditing and version control ...
0
votes
1
answer
223
views
Kamal + Grover::JavaScript::TimeoutError
I'm using Kamal to deploy a Sinatra web app and within that I'm using Grover to process pdfs. The problem I've got is that when I to https://myserver.com/pdf3 I get the following error;
Grover::...
1
vote
1
answer
550
views
How to use Rack::RewindableInput::Middleware in a Sinatra Ruby app?
This is the code that works just fine:
require 'sinatra'
post '/foo' do
"Equals to #{params[:a]}!"
end
If I send POST request, it returns all right:
$ ruby foo.rb -p 8888
$ curl -X POST -...
1
vote
1
answer
95
views
Cannot get request body from form in Sinatra
I have a form submission in Sinatra that's not showing any received params. Chrome is showing the form submission payload as proper, so the form is fine. It's just not making it through to Sinatra ...
0
votes
1
answer
68
views
Updated - Sinatra doesn't recognize any route
I have a Sinatra 4 app, and I'm trying to load a CSS file. I have placed it in /public/application.css and in my view's header I have added <link rel="stylesheet" type="text/css&...