sinatra

Multipart response in Ruby/Rack

I want my server to send a multipart response (multipart/x-mixed-replace). I'd prefer some kind of solution using the Sinatra framework or a generic Rack app, but any example in ruby would be nice. Here's the equivalent of what I'm trying to do, in PHP: <?php header('Content-type: multipart/x-mixed-replace;boundary="rn9012"'); prin...

What's the fastest way for a true sinatra(ruby/rack) after_filter?

Okay it's a simple task. After I render html to the client I want to execute a db call with information from the request. I am using sinatra because it's a lightweight microframework, but really i up for anything in ruby, if it's faster/easier(Rack?). I just want to get the url and redirect the client somewhere else based on the url...

How to use params with slashes with Sinatra ?

Playing with sinatra, I'm stuck on a little problem : when I use params with slashes, it confuses the router engine. So is there a nice way to handle this kind of param without having to encode it ? The code looks like get 'add/:url' do #.... end And I intend to get something like /add/http://sctackoverflow.com/ working ...

Sinatra success stories

Have you used Sinatra successfully? What kind of a project was it? In what situations would you recommend using Sinatra instead of Rails or Merb? ...

Best way/practice to ensure links are going to proper location when not on root of domain?

I've been wondering this for a while now, but what is the best way to ensure that in a web app (RoR, Sinatra, PHP, anything) that when you are creating links (either generating with a method, or writing in by hand) that they go to the proper place whether you are on the root of a domain or not: http://www.example.com/ or http://www.examp...

Why do I get an error on the first request after restarting a Sinatra app with Rack and Phusion Passenger?

After I touch tmp/restart.txt and my app restarts, the first request throws an error, usually something about not finding Haml::Engine or some other gem. The second and subsequent requests all work fine. I was having this problem on Dreamhost which was running Rack 0.4.1 and Sinatra 0.3.3 but after moving to my own host and running a ne...

How to use haml with heroku ?

Hello I try to get haml working without the gem with sinatra (Heroku doesn't allow gem install, as far as I know) What I've done so far: clone the haml git repo inside my project add : require 'haml/lib/haml.rb' to my sinatra main file the following works: get '/test' do Haml::Engine.new('%p test').render end but the following...

All I need is ActiveRecord and ActiveMailer, should I use Rails/Merb?

I have a small web application that is currently running on Sinatra. It only has two pages so I don't really need controllers or many views. I have included ActiveRecord to interact with a database and ActiveMailer to send and receive mail. Would it be worth it to use Rails, or Merb on a project as small as this? I find myself adding fe...

Integrating models and views in new Sinatra extensions

So I would like to use the new possibility to create extensions for Sinatra. My Extension needs to integrate a model and some views/templates but I don't know how to or where to integrate them? Did anybody already built something more complex than the example from the documentation? ...

How to handle cookies when testing with Webrat?

Hi! I'm writing Cucumber tests for a Sinatra based application using Webrat. For some tests I need to implement a scenario like Given I am logged in as admin When I am visiting "/" Then I should see "Settings" I define steps like this: Given /^I am logged in as "(.+)"$/ do |user| visit "/login" fill_in "login", :with => user...

Whats the best way to put a small ruby app online?

I have a small ruby application I wrote that's an anagram searcher. It's for learning ruby, but I would like to put it up online for personal use. I have some experience with Rails, and many here have recommended Sinatra. I'm fine with either, but I cannot find any information on how to use a text file instead of a database. Is there ...

What are scenarios in which one would use Sinatra or Merb?

I am learning Rails and have very little idea about Sinatra & Merb. I was wondering are the situations where you would use Merb/Sinatra. Thanks for your feedback! ...

Where can I get Ruby, GraphViz and Dot hosted?

I want to find some hosting for a small Ruby (Sinatra) app that uses Graphviz and Dot. Heroku is usually my favorite because it's a) Free, b) Simple, and c) Scalable. Heroku doesn't do Graphviz and Dot, so I'm looking for an alternative. Any ideas? ...

What's the best way to talk to a database while using Sinatra?

As I understand it, the Sinatra framework, unlike Rails, does not provide an ORM. In that case, how do you talk to a DB in a Sinatra app? Or is Sinatra only for apps that don't use a DB? ...

Are there any important differences between Camping and Sinatra?

My feeling is that the differences between Camping and Sinatra are not very significant and that you could safely choose either one and be ok. But I want to ask the Ruby experts if this is true. Are there in fact any important differences between the Sinatra and Camping microframeworks? And how would you go about deciding which one to us...

What are the main differences between Sinatra and Ramaze?

I'm looking for a lightweight Ruby web framework and have come across Sinatra and Ramaze. Both seem extemely light, concise and simple. But I don't know enough about either to say what the main distinctions are. Perhaps someone with experience with one or both of these could comment? ...

What's the difference between Rack and Passenger?

I'm trying to deploy a Sinatra app to Dreamhost and it says the following: Since DH supports Passenger, which in turn supports Rack-based ruby applications, DH does indeed support Sinatra. I'm having difficulty parsing that statement - what's the difference between Rack and Passenger (and why is Sinatra "Rack-based")? ...

Are there any potential disadvantages in using a Ruby framework other than Rails?

I would like to use a lighter framework than Rails (Sinatra/Ramaze/Camping) but am concerned that by doing so I will not be able to use a lot of shared libraries that have been tailored to Rails in the form of plugins. Is this a major concern or are most of these plugins usable across different Ruby frameworks? Are there any other poten...

How to run a basic asynchronous job within sinatra ?

I'd like to run a basic asynchronous job exec('curl -0 '+url) from a sinatra app, I've tried to do that with fork and detach but it seems bogus. (I'm on windows) ...

Using Rack::Session::Pool with Sinatra

Hi, I'm exploring Sinatra and I want to use sessions but I don't want them to be stored in a Cookie, I found Rack::Session::Pool which works very well. Now I want sessions to expire after a certain duration but I don't understand how to instanciate the Rack::Session::Pool and them use it in Sinatra. Any Clue ? ...