Setting R_HOME for PL/R in PostgreSQL in Ubuntu


You want to use the PL/R extension in PostgreSQL, and after the package installation you need to set up the R_HOME in PostgresQL.


Add the following line to the bottom of your PostgreSQL configuration file as sudo:

make the unpermitted parameters errors in Ruby on Rails more obvious


When you are adding new attributes to your model after the initial creation, they are not by default included in the permitted parameters list. Sometimes the error is not so obvious to see when testing, unless you look at the test log files.


To make the error more obvious, there is the following configuration option that you can set up in config/environments/test.rb (tip taken from Rails 4 In Action):

OSVDB 119927 : http Gem for Ruby SSL Certificate Validation MitM Spoofing


There was a security vulnerability issued by Gemnasium about the http gem with the title OSVDB-119927 – MitM Security Vulnerability.

The details for it are here.


After some investigation (gem dependency http –reverse-dependencies) it turns out that the twitter gem (5.14.), is using an older vulnerable http dependency (0.6.3).

In order to remove this warning and until there is a new twitter gem released, you can use the github master branch of twitter, like:

Project ERROR: Unknown module(s) in QT: webkitwidgets


You are trying to bundle install a Gemfile that includes the capybara-webkit gem, in an Ubuntu system but you get the following error:


It seems that the latest ubuntu versions are using QT version 5 instead of 4. So in order to be able to install the gem you would need to install the qt development libraries for version 5 like:

minitest assert_routing with method included in path


When trying to use the minitest assert_routing with the first parameter representing the path as a hash that includes both the path and the method, and run the tests rails complains about SyntaxErrors.

When trying to use it as suggested in the ‘Rails 4 Test Prescriptions’ Pragmatic Programmers book (p. 172 – Minitest and Routing) which is:

the error is:

even when trying to have the second parameter as a hash:

the error is similar:


Seems that you need to pass the parameters enclosed in brackets, so the following would work:

Upgrading jquery-ui-rails from 4.2.1 to 0.5.0


You would like to upgrade your jquery-ui-rails gem from a version before 0.5.x to the latest version 0.5.0, but when you do that your tests are failing with error messages similar to the one below:


According to the changelog the naming between 4.2.1 and 0.5.0 has changed jquery-ui-rails

So if you were using something like the following in your app/assets/javascripts/applications.js file (as used in the depot example in the Agile Web Development with Rails 4 book):

you would need to change it to the following after upgrading your jquery-ui-rails gem to ~> 0.5.0:

Upgrading from rspec-rails 2.x to rspec-rails 3.x


You would like to upgrade your rails project from using rspec-rails 2.x to the latest rspec-rails 3.x version. According to the rspec-rails documentation the new 3.x includes many breaking changes.


The full instructions for upgrading from rspec-rails 2.x to rspec-rails 3.x are here, but you may not need to complete all the steps described in there.
So you could try with the following shorter steps:

  • Run your rspec tests and make sure that they all pass
  • Upgrade your rspec-rails to the version 2.99 provided by the rspec-rails team
  • Run your rspec tests again, and you should have deprecation warnings. Usually that would consist of:

    which you could add to your spec/spec_helper.rb file
  • Run your rspec tests again and this time they should have no deprecation warnings
  • If they all pass then upgrade to the latest rspec-rails (ie 3.0.1).
  • Run your rspec tests again, and this time you should normally have one deprecation warning:
  • Delete the line require ‘rspec/autorun’ from your spec/spec_helper.rb file
  • Rerun your tests and they should all be passing in rspec-rails 3.x now

bin/rails:6: warning: already initialized constant APP_PATH


You are getting the error:

when you are trying to start the local webserver with rails s.


That happens when are using the bootstrap rails gem as in:

It is important that the bootstap rails uses in the require is used with a dash and NOT an underscore.
So when you write the the gem as follows:

and restart your server you should no longer have the error message.

find out the status of rails application migrations


You would like to know at any moment the status of your migrations, if they have been applied, rolled back etc.


There is a very usefull rake task that can give you the list of your migrations withouth having to look at your schema.rb file:

Rails 4 Application Development HOTSHOT review

A new book about rails 4 development has recently been published by Packt called Rails 4 application development HOTSHOT.

It is a book that can be described as a ruby on rails application cookbook. It focuses on the changes with the rails version 4 and includes a lot of the latest techniques and practices developing rails applications.

The book consists of 10 different projects, that can be used as the basis for further developing these applications.
The projects are:

  • Social Recipe-sharing Website
  • Conference and Event RSVP Management
  • Online Social Pinboard
  • Restaurant Menu Builder
  • Customisable CMS
  • Analytics Dashboard
  • Api Mashup – Twitter and Google maps
  • API only application
  • Video streaming website
  • Rails engines E-commerce

In each one of them different aspects of development are presented, for example twitter-bootstrap integration, devise authentication and so on.

So concluding this short review, this is a book that is recommended for ruby on rails developers with some previous experience, and it can provide the starting point for quite a few interesting projects.