Tag: resolution

Resolve Net::HTTPBadResponse: wrong status line

In Ruby/Rails, if you’re running into the following error: Net::HTTPBadResponse: wrong status line When attempting to post data to a secure (https) url, with something similar to: Net::HTTP::post_form(“https://www.example.com”,{})   Then you can rewrite your request to avoid the exception like this: url = URI.parse(“https://www.example.com”) http = Net::HTTP.new(url.host,url.port) http.use_ssl = true request = Net::HTTP::Post.new(url.path,{}) request = […]

Rails conditional migrations – ensure column does not exist

If you’re running into a rails migration exception, such as: column “x” of relation “y” already exists Then you can conditionally run the associated migration in the following way: YourModel.reset_column_information unless YourModel.column_names.include?(“the_column”) add_column(:your_models, :the_column, :boolean, :default=>true) end   Of course, it is probably best to address the underlying workflow issues that caused this issue to […]

Sublime Text 3 – Ubuntu – Package Control installation

If you’re running into the following error when attempting to install “Package Control’ for Sublime Text: urllib.error.URLError: Then you’ll need to install manually. The instructions suggest that you “Browse Packages”, then navigate to the “installed packages” directory. However, if you’re like me, the “Installed Packages” directory is not up the directory tree, it is down. […]

Rails remote multipart form with remotipart bind ajax:success

Rails 3.x / 4.0 does not handle remote multipart forms natively, so a workaround is needed. To get remote multipart forms working correctly you can use the following steps (quick solution). First: Add the remotipart gem to your GemFile gem ‘remotipart’, ‘~> 1.2.1’ Then, Update your javascript manifest file (in basic configurations this is usually […]

Bootstrap Modal – load remote url multiple times

If you’re using Bootstrap 3.x to generate a remote link based modal, you’ll notice that re-clicking the same link does not re-request the content of the remote URL and instead just re-displays the same content from the previous load. This isn’t a great result in many cases (forms for new objects for instance). To resolve […]

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 […]