Tag Archives: ruby on rails

[rails 4] add a reference to a table with another name

They default way in rails 4 to add foreign keys is simply add_reference :people, :user And this will add a column user_id to the people table, if the table exists. I have been looking in the rails code where this is handled, and it is really straightforward. Note that standard rails does not really do […]

How to clean assets in rails 4

Gentle reminder, do not forget, in rails 4 rake assets:clean seems to work, but actually does nothing. That is not entirely true: it only cleans the old assets, leaving the three most recent versions of the assets intact. So it is a like a mild cleaning, a throw-away-the-garbage-clean, a bring-those-old-clothes-you-never-wear-to-the-thriftstore-clean. But sometimes that does not […]

Run rails 2.3.18 using ruby 1.8.7 on windows server 2012

For my current job we have two 2.3.5 rails sites, of which I already succesfully upgraded one to rails 4. For the other we still need to start the migration, and we were asked to install new windows servers to run the rails servers on in the meantime (let’s not digress why they choose windows, […]

complete coverage with SimpleCov

When using SimpleCov in a very ill-covered project, I got amazingly good results: SimpleCov just did not count not-covered files. So files that were never used in our test-suite, were just simply being ignored. While I understand that approach, it did not feel good. I want to measure absolute progress, and I want to know […]

[netzke] make action buttons toggle

I am currently converting my GIS application that needs two browser windows (one for the map, and one for the administrative data and functions), to a single window application using the netzke gems (which in turn rely on Sencha Ext js). The netzke gems are extremely powerful, but there is a bit of learning curve […]

generating pdf on heroku

I was investigating ways to generate pdf’s in Ruby on Rails, but I had one enormous constraint: it had to deploy on heroku. There are two very different ways to generate pdf’s in ruby: use prawn: it is pure ruby, very powerful. It has it’s own DSL, that unleaches all the power of building a […]

testing drag and drop of jQuery UI sortable with cucumber and capybara

The Problem For jottinx I wrote a small piece of code that allowed to sort items using drag and drop. Of course, after writing it and making sure it works (manually), I want to make sure it keeps working. So I add a test, using cucumber. My scenario actually looks pretty straightforward: The difficult bit […]

a guide to doing nested model forms in rails (3.1)

One recurring problem when doing Ruby on Rails development is a nested model form. Nested Model Form: a single form that contains multiple, nested models. For example a project with its tasks. A nested model form will allow you to create or edit, in 1 form, the project and each of its tasks. With the […]

rails 3.1: creating a new application (fast!)

Take the following steps, by preference install this in a specific gemset These steps will create a new gemset and start using it, then install bundler and rails 3.1 (which is still pre-release at the time of writing). Now in rails 3.1 there is a new requirement: you will need a javascript runtime. You can […]

configuring TeamCity to run rails projects

In our team we are very happy users of RubyMine, by JetBrains. Now JetBrains also has a continuous integration server, called TeamCity, and it is also capable to run rails rake tasks. Installing TeamCity is close to a non-operation, as described on their website. Just download the package, extract, and run bin/runAll.sh start. Then you […]