sinatra

How to dump an HTTP request from within Sinatra?

Is there a way to dump all incoming requests to a Sinatra application in the exact way the application receives the data? Maybe some sort of Rack middleware? ...

No Such File To Load Passenger and Sinatra

I've recently updated to Ruby 1.9.2 (RVM), Sinatra 1.1 and Passenger 3.0.0. I have a simple application composed of: # config.ru require 'rubygems' require 'sinatra' require 'app.rb' run Sinatra::Application # app.rb require 'rubygems' require 'sinatra' get '/' do erb :index end If I run the application from the terminal using ...

Looping through weeks of the year in Ruby (Sinatra)

Hello. I'm creating a very simple timeshare application using Sinatra and Datamapper. Every user in the application will have n reservations and for the time being each reservation runs from Monday to Sunday and there can only be one reservation per week. Now I will need a view with a textbox (and label) for each week of the year where ...

generating css file from new sass format (scss) with sinatra and haml

I am writing a sinatra app with haml and sass. When I try to link in the stylesheet with a scss extension located in my views folder I get the following error: NoMethodError at /nav.css undefined method `scss' Here is my get method get '/nav.css' do content_type 'text/css', :charset => 'utf-8' scss :nav end I have only gott...

Specifying Content Type in rspec

I'm trying to build an rspec test that sends JSON (or XML) via POST. However, I can't seem to actually get it working: json = {.... data ....}.to_json post '/model1.json',json,{'CONTENT_TYPE'=>'application/json'} and this json = {.... data ....}.to_json post '/model1.json',json,{'Content-Type'=>'application/json'} a...

Validate uniqueness on combined fields in DataMapper

Hi. I want to be able to put entries in my database where the manufacturer will be represented multiple times but not the same combination of manufacturer and model. So "Sony(manufacturer), Tv(model)" is okay "Sony(manufacturer), OtherTv(model)" but the third entry "Sony(manufacturer), Tv(model)" is not okay since the combination of manu...

Deploy Gollum wiki to Heroku

Gollum is "A simple, Git-powered wiki with a sweet API and local frontend." It's hosted on GitHub: http://github.com/github/gollum It seems to be a simple Sinatra app, and as such, it seems like it should be easy to deploy to Heroku. I can't seem to get it to work. Mostly because I know next to nothing about Rake and config.ru files...

can't find/retrieve results from a specific table with datamapper

I am working on a sinatra app with datamapper connected to a mysql database and am having problems retrieving/finding records from only one specific table. I can insert into it with datamapper find but when I try to do @sleepEntries = Sleep_Log.all I get the following error: ArgumentError: argument out of range. When I load everything in...

Where do I put Sinatra files intended to be embedded in a Rails3 app?

I want to use the new Rails3 feature that allows you to embed a Sinatra app inside rails. In my routes file, I have: # app names changed to protect the (not so) innocent MyApp::Application.routes.draw do match "/service", :to => MyService ... end And in /lib/my_service.rb I have class MyService < Sinatra::Base get "/" do "...

How connect to db depending on @request.host value?

How connect to different db depending on @request.host value? Using Sinatra and MongoDB with Mongoid. I need to read a Sintra application's menu, data ... from different databases. I wish to deploy it only in one place and depending on request.host(subdomain) value to serve the specific pages. ...

rails documentation or faq addon

Before I roll my own I'm just curious if there are any other solutions similar to heroku's docs (sinatra) or the rails guides template for making a simple faq page for a rails app. I like heroku's on sinatra and have been currently using just a simple pages controller with markdown, but i'm looking for maybe something even better suited...