Data dodania Pytanie
2017-04-20 19:04 Detect browser in Sinatra »
I need to know (on .rb/.haml level) if device is mobile or if browser is not supported. I don't want (or it won't work well for my need) to parse user...
(1) odpowiedzi
2017-04-19 22:04 How to return a JSON response from a before block »
I am writing a Sinatra-based API, and want to protect certain endpoints with an API key, validating the key before the route is processed. I understa...
(2) odpowiedzi
2017-04-19 08:04 How used consoled log to ajax param? »
Im trying to use this console log $.post("greeting", { salutation: console.log(5 + 6), name: "Friend" }, to ajax param salutation but not works H...
(1) odpowiedzi
2017-04-19 01:04 How to add data to returned ActiveRecord query records »
I'm doing a simple query to a database table to send off to an external service, but I need to add an element to each of the returned records before I...
(1) odpowiedzi
2017-04-18 17:04 Sinatra event triggered by Rufus Scheduler »
Trying to send an event from within Rufus Schedulers results in this error: { 70231586340180 rufus-scheduler intercepted an error: 70231586340180 ...
(1) odpowiedzi
2017-04-17 12:04 How to output variable in sinatra without <%= »
In Rails, there exist such helper as "concat" to output variables inside <% %> block for erb remplates. Which helper can I use in Sinatra to perfor...
(1) odpowiedzi
2017-04-15 01:04 Enabling HTTPS with Rack, Puma and Sinatra? »
I have a Ruby web application built with Sinatra, Rack and Puma. I'm using Sinatra to implement the controllers (MVC pattern), each handling a differe...
(0) odpowiedzi
2017-04-14 22:04 How to display data on the same page once a button is clicked [Sinatra/Ruby] »
I'm practicing making a web app in Sinatra and I'm trying update a page so that information from a database is displayed once a button is clicked (mor...
(1) odpowiedzi
2017-04-13 20:04 Changing the base URL for Capybara Acceptance Tests »
I am developing a sinatra based web application and I extensively use tests to make sure that everything is working before deployment. As testing fram...
(1) odpowiedzi
2017-04-12 01:04 How do we speed up transmission between client and server using websockets? »
Currently, I am using websockets to send an image to my server, process it, and then send it back. Specifically, I am using Ruby with Sinatra and sina...
(1) odpowiedzi
2017-04-11 19:04 Multiple file upload with ruby & sinatra »
I'm using the following code to upload a single file through a form: app.rb @filename = params[:file][:filename] file = params[:file][:tempfile] Fi...
(0) odpowiedzi
2017-04-11 05:04 How to read mixed POST types with sinatra »
I am having similar issue to this one In my case I am sending 'mixed' content using: ... $.ajax({ type: 'POST', url: '/create_product', ...
(0) odpowiedzi
2017-04-10 16:04 Sinatra and Postgresql -- how to use pure Sql, perhaps without ActiveRecord »
I have a quite simple Sinatra application for which I don't want to bother to create a model. I need to insert data into a Postgresql database without...
(1) odpowiedzi
2017-04-09 22:04 Ruby: class passes methods of running object »
I have a class where I create a new instance variable called @client which is an object in itself. Now, in another file I create an object from this c...
(1) odpowiedzi
2017-04-08 19:04 How to return json using mongoid »
I have a model: class Client include Mongoid::Document field :name, type: String field :age, type: Integer index({ name: 1 }, { unique: true ...
(1) odpowiedzi
2017-04-08 11:04 Why is an Array in my payload being flattened in Sinatra / Rack::Test? »
I'm trying to test a small Sinatra app using rspec. I want to pass a rather complex payload and am running into issues i do not understand: my payload...
(1) odpowiedzi
2017-04-06 21:04 Process the results of an HTTP request in the background - Ruby »
I wrote a quick (hah) server to accept a JSON payload that contains a URL to download an archive from. After parsing the JSON I download the file, unc...
(1) odpowiedzi
2017-04-06 15:04 best practice to run a sinatra app within docker »
I intend to create a microservice using sinatra and docker. I already know how to make eveything work in development: write sinatra app write docke...
(1) odpowiedzi
2017-04-06 13:04 Sorting elements in DataMapper »
I have a database, and I need to sort the whole table by the length, however I've got stack on it. require 'dm-core' require 'dm-migrations' require ...
(1) odpowiedzi
2017-04-04 23:04 What's the difference between defining helpers with "helper do" and in the main scope in Sinatra? »
When I define methods in Sinatra (classic mode) in the main scope and in the helpers do block, in both cases, the methods are available both in all ro...
(0) odpowiedzi
2017-04-04 23:04 HTTParty Patch Sinatra API returns "invalid value" »
The following route works as far as reaching out to the api. The api returns "invalid value". I'd assume this is a data type issue. API docs: val...
(1) odpowiedzi
2017-04-04 00:04 Can't POST results of ActiveRecord query via HTTParty »
I'm running a simple Sinatra app where I need to query some data and send a POST via JSON to a webhook URL for processing. I'm not sure how to properl...
(1) odpowiedzi
2017-04-03 18:04 Putting most accessed route first? »
I've read that Sinatra reads routes from top to bottom, meaning if a request matches 2 routes, the route defined first will be executed only, and the ...
(0) odpowiedzi
2017-04-03 06:04 Sinatra scope nomethoderror »
I am trying to making Sinatra application. But now I have a bug I can't solved. So I want help. When I entered /tasks?status=done, the application a...
(1) odpowiedzi
2017-03-30 19:03 Sinatra - how to match production urls with the app's urls »
Consider the following simple Sinatra application: require 'sinatra' post '/user/login' do # login logic... end When deploying the application to...
(0) odpowiedzi
2017-03-30 18:03 Difference between a wildcard and a named route in Sinatra »
I've been watching several tutorials on Sinatra and can't find the difference, between, say: get "/hey/*/there/*" vs. get "/hey/:first/there/:seco...
(1) odpowiedzi
2017-03-28 17:03 Where do i have to start the service 'rackup' for sinatra while using rvm on ubuntu »
i am developoing an webapp in the IDE rubymine on ubuntu and i recently installed the gem sinatra for my gemsets to write an REST-API for my webapp. I...
(1) odpowiedzi
2017-03-28 15:03 Sinatra app cannot find ActiveRecord tables »
I'm writing a Ruby app using Rack, Sinatra, Active Record, and SQLite3 (in-memory). I setup my in-memory DB as follows: class MyDatabase def sel...
(0) odpowiedzi
2017-03-26 17:03 sessions arent working on sinatra »
So i've been using sinatra and well no matter what i try i cannot seem to get sessions to work as intended. Im enabling session/cookies with the fol...
(0) odpowiedzi
2017-03-25 17:03 Connect to local mac server from device »
Im trying to connect to a ruby sinatra server that im running locally on my mac from an app using the following code: func load(finished: @escaping (...
(1) odpowiedzi
2017-03-24 15:03 Ruby how to call a class setter with yield »
I was able to get my code working, but I don't like the way it works syntaxually - not sure if that is even a word. My code currently: user.set_phon...
(1) odpowiedzi
2017-03-23 05:03 Sinatra app form isn't posting the entire form »
I have a basic Ruby/Sinatra app with a form that doesn't seem to be working quite right. The form has two inputs, a text box and a textarea. When I in...
(2) odpowiedzi
2017-03-22 16:03 Use Sinatra's action as method »
I want to call a Sinatra action as a method. For example, I have defined get '/' do puts "hi" end I want to call the above as a method but not as...
(0) odpowiedzi
2017-03-22 13:03 How does Module change the scope? »
My understanding of scope I have been a Javascript developer for a long time and I am used to this... var globalVar = "some value"; getGlobal...
(1) odpowiedzi
2017-03-22 08:03 Validating new MongoID record against existing documents »
I'm building a REST service with Ruby, Sinatra and MongoID. I've set up basic validations for various fields but for two of the fields I need to valid...
(0) odpowiedzi