rack

Rack::Session::Pool with Sinatra

I have a Sinatra webapp I've built using enable :sessions where I access my session data with session[:mything]. I now want to store data on the server side (ie. with database based sessions) and I can't figure out how to use Rack::Session::Pool, which appears to be the thing I need to use. How do I o about converting my webapp for use...

How to setup a Sinatra app under Apache with Passenger?

Let's say I have the simplest single-file Sinatra app. The hello world on their homepage will do. I want to run it under Apache with Phusion Passenger, AKA mod_rails. What directory structure do I need? What do I have to put on the vhost conf file? I understand I need a rackup file. What goes in it and why? ...

Rails Gem or code to have your rails application respond to email and create a record in the database.

I am creating a ruby on rails application and I want my users to be able to email the application and have the application take in the email and create a issue record in the database. Is there a GEM or Code that can be used to have the rails application get the email and parse out the body and stick it into an issue table. ...

Has anyone tried running IronRuby.Rack through Kayak?

I recently learned about kayak, an HTTP server written in C# (i.e. not through IIS). I'm wondering if anyone has tried hooking up IronRuby to run Rack through this platform? ...

rackup in Netbeans project

Hi How can I configure a Netbeans Ruby project so that it does not run a Ruby interpreter (a Ruby "platform"), but starts up rackup? Thanks ...

Sinatra and Bundler

Hi, I'm trying to get Bundler setup so I can deploy my Sintra a server with all the correct gems. I've created my Gemfile source :gemcutter gem 'sinatra', '1.0' gem "nokogiri", "1.4.2" gem "rack", "1.1.0" gem "dm-core", "1.0.0" gem "dm-migrations", "1.0.0" gem "dm-sqlite-adapter", "1.0.0" gem "pony", "1.0" Next I created a Confi...

Drag and drop ala GMail a gem for Ruby / Rack?

Is there a widget or a gem which implements this feature? It works only in Chrome and Firefox but it is very cool and no plugins are needed http://gmailblog.blogspot.com/2010/04/drag-and-drop-attachments-onto-messages.html Or which would be the best practises to implement it? ...

Automatically encode Rack output with JSON when Content-Type is application/json

I've got a modular Sinatra app and I'd like to encode the output as JSON when the content-type dictates. At the moment I'm doing so manually in my routes: get 'someroute' do # content-type is actually set with a before filter # included only for clarity content_type 'application/json', :charset => 'utf-8' # .. # {:su...

Rails parses jQuery quotes wrong

I'm using Rails 2.3.8 and have a jQuery AJAX form using posted using: jQuery.fn.submitWithAjax = function() { this.submit(function() { jQuery.post(this.action, $j(this).serialize(), null, "script"); return false; }); return this; }; If I try to post a text that has quotes in it such as 1 "2" 3 Only what is inside the ...

Where do you put your Rack middleware files and requires?

I'm in the process of refactoring some logic built into a Rails application into middleware, and one annoyance I've run into is a seeming lack of convention for where to put them. Currently I've settled on app/middleware but I could just as easily move it to vendor/middleware or maybe vendor/plugins/middleware... The biggest problem is...

Rack Web Server and https: tutorial?

Can anyone provide a link to a description or tutorial dealing with the setup of https and installint certs etc using the Ruby RACK webserver? Thanks ...

rack duplicates every log message

When I test a Sinatra app on my local box with rackup, every log message appears twice. How can I get them to appear only once? ...

Rails Modify Request Route

As luck would have it, I am creating a Rails application (2.3.8) in which I need to change where a request is dispatched based on some criteria. Basically, I need a custom dispatcher. I have looked at using Rack to modify the request, and in certain instances, re-route the request to a different controller that knows that to do with th...

How can I pass SSL options into "rails server" in Rails 3.0?

Is there a way to pass SSL options into "rails server" (on Rails 3.0.0), using a custom Rack config or something similar? I'm trying to do two things: enable Cucumber to run tests that involve both secure and non-secure URL's, and make things simple for new developers, so they don't have to set up Apache and configure all the SSL/cert...

Sinatra, Rails and Rack - User/Session Management

Does anyone know of a way to authenticate in a Rails application and allow other Sinatra applications to pass that authentication token and session state through rack? I'm looking for something that basically allows single sign on. (I already have the secret and key in the rails app with authentication, now looking to use that as the si...

Streaming data from Sinatra/Rack application

I am trying to stream textual data (XML/JSON) from a Ruby (1.9.1p378) Sinatra (1.0) Rack (1.2.1) application. The suggested solutions (e.g. http://stackoverflow.com/questions/3027435/is-there-a-way-to-flush-html-to-the-wire-in-sinatra) do not seem to work - the server just blocks when I yield elements of some infinite stream (e.g. from %...

Loading a file with Rack from a specific route

I'm following part of this Railscast and trying to load a static file using Rack when a specific route is called: match "/myApi.js" => lambda { |env| [200, {}, Rack::File.new("/v1/myApi.js")] } No matter what I do, even if I just try to send a string through: match "/myApi.js" => lambda { |env| [200, {}, "Hello World"] } I still re...

Ruby on Rails: How are people making search forms on sites with the broken textfield parsing that removes quotation marks?

I'm using Sunspot Solr search, which works fine for the most part for basic search. It's supposed to be able to handle quotation marks around phrases, so that a search for test case will return documents with both test and case, whereas a search for "test case" should return documents with the phrase test case. However, I've been pullin...

Ruby Rack & Multiple Internet Domains

I am having two domains running each a separate web application that should be served by one server i.e. one ip address. Depending on the request the proper application should be selected by some rack middleware. Is there already one out or do I have to write my own? (Writing my own wouldn't be a problem but if I could use an existing on...

How can I check if an user is logged in or not in a Rails Metal?

I use Authlogic to log the user in. Inside a Rails Metal I want to check if the user is logged in or not. Just that, I don't care who the user is. I want to avoid touching the database so I should not do UserSession.find. My main doubts: Will making use of env['rack.session'] solve that? Where is that stored? Is that secure? I'm current...