#sinatra
13 posts tagged sinatra. Clear filter
-
How To Fix ActiveRecord::ConnectionTimeoutError with Sinatra
If you get this error message ActiveRecord::ConnectionTimeoutError could not obtain a database connection within 5.000 seconds (waited 5.001 seconds) Try closing the connection after each request...
-
Roll Your Own Session Based Flash Messaging w/ Sinatra
Session based flash messages are fairly common in web apps. They work well when you have a temporary status to report back to the user, such as successfully saving a form. If you use Rails it comes...
-
How To Write Your Own Time Comparison Function in Ruby Like time_ago_in_words Without Rails
-
How to Boot Up Multiple Sinatra Applications at the Same Time with Foreman
Foreman is a process management gem for ruby applications. It is used in combination with a Procfile for configuration instructions. A typical Procfile looks something like this Example Rack...
-
How to Render Partials with an Underscore in Sinatra
Sinatra doesn't have a method for rendering partials. It defers to the template language of your choice. For instance, if you're using ERB, it's as simple as Rails has a nice convention of using an...
-
How To Enable IFrame Support on Heroku with Ruby on Rails and Sinatra
This actually has more to do with Rails and/or Sinatra than it does with Heroku. You have to enable IFrame support in your headers explicitly. With Rails you can add this to your...
-
Roll Your Own Full Page Caching in Sinatra
It's as simple as this. Use File.basename to make sure that params[:page] doesn't contain path information. This way arbitrary requests aren't able to traverse the filesystem. Then just check to...
-
JSON::GeneratorError: only generation of JSON objects or arrays allowed
If you run into this error message try switching to an earlier version of ExecJs.
-
Testing current_user and Sessions with Sinatra and Rack Test
Assume you have your standard Sinatra application. app.rb require 'sinatra' configure do enable :sessions end get '/' do if session[:userid] "OK" else raise "NOT OK!" end end To test this you need...
-
How To Use Rake to Run Your Test Suite with Sinatra
If you're using Sinatra and you want to use rake to run your test suite, you will need to create a Rakefile and put this in it. This assumes your test suite is under the 'test/' directory and the...
-
Install do_mysql Ruby Gem on Mac OS X
I ran into the same problem when installing mysql gem for Rails development. This fix worked for me http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/ The same...
-
Manage Sinatra Server in Development Mode with Shotgun
Sinatra won't reload your files. So if you're developing your app and want to see any changes made in the browser, install the shotgun gem. You can then use shotgun to run your server Presto, your...
-
Deploy Sintra App on Ubuntu Using Apache2 and Phusion Passenger Module
Check it out http://sinatra.seanbehan.com/ This assumes Apache2 and the Phusion Passenger module have already been installed. If not you can get up to speed w/ this resource...