Tag: Rails

Rails 4 TurboLinks with JQuery document ready

Using JQuery’s $(document).ready() functionality seems to be broken when using’s the Rails Gem Turbolinks. However, to fix any issues you are experiencing, add the jquery-turbolinks gem to your Gemfile > gem ‘jquery-turbolinks’ Then, add the following line to your JS manifest file, typically application.js in your assets directory: //= require jquery.turbolinks After which, restart your […]

Rails Capistrano deployment: SSH, Error reading response length from authentication socket

If you’re running a rails application with capistrano and you run into the following error: Error reading response length from authentication socket When you attempt to connect via cap, for instance > cap staging deploy Then make sure you can answer the following questions with a ‘yes’ before continuing. 1) Is my private key properly […]

Rails slow on Ubuntu Virtualbox instance

I ran into an issue where a Rails 3.1 application running on Ubuntu 12.04 in a VirtualBox instance (development) was running ridiculously slow. Sometimes, before the server would register a request, it would take >5 seconds, then another 5 seconds just to load a simple view. Obviously, this is an unacceptable amount of time when […]

Rails select method with default value

When using the select form builder method in rails, for instance: f.select In conjunction with the options_from_collection_for_select method, like f.select :field, options_from_collection_for_select(@fields, ‘id’, ‘name’) Remember, there is a fourth argument in the above method, which defines the selected value, like so f.select :field, options_from_collection_for_select(@fields, ‘id’, ‘name’, @object.field)

Keep heroku from falling asleep / idling (even with PHP)

Ruby on Rails Scenario The easiest way to keep a Rails App from idling is to use New Relic Standard (free), in conjunction with their availability monitoring. You can do this in a couple of ways: Issue the following command with the Heroku Toolkit heroku addons:add newrelic:stark Or, login to your heroku account and provision […]