http://clearcove.ca/wp-content/themes/press

29 Sep 2009, Posted by Jo Hund in Ruby/Rails, 1 Comments

Recipe: Detect whether cookies are enabled in rails


If your Rails app requires cookies, this recipe is for you: It detects whether cookies are enabled, and if not, shows a message to your users.

(more…)

Continue Reading...

30 Mar 2009, Posted by Jo Hund in Note to self, Ruby/Rails, 0 Comments

Simplest way to use cron with Rails


For simple applications I use cron to run automated background jobs like sending emails or indexing sphinx.

I like to have all aspects of my application under version control. Cron is no exception. To do this, I add a file named “crontab” in /config. In there I add all my cron jobs in regular cron notation.

(more…)

Continue Reading...

14 Dec 2008, Posted by Jo Hund in Ruby/Rails, 8 Comments

Recipe: RESTful search for Rails


This recipe shows you how to search, filter, and sort your resource lists in a restful way. We will look at the most simple way to accomplish this and then provide some pointers to further improvements. This recipe works great with will_paginate. It is an end to end solution (model, view, and controller). This recipe requires Rails 2.2.2 or greater if you want to use :joins in named scopes. Otherwise Rails 2.0 is sufficient.

(more…)

Continue Reading...

07 Dec 2008, Posted by Jo Hund in Software, Tools, 0 Comments

strftime cheat sheet


I have used strftime a lot lately on one of my projects. I could not find a user friendly reference for strftime, so I wrote one. Here is my user friendly strftime cheat sheet in PDF format:

strftime reference

strftime reference

(more…)

Continue Reading...

31 Aug 2008, Posted by Jo Hund in Ruby/Rails, 7 Comments

Recipe: Make request environment available to models in Rails


How often do you wish you had access to current_user in one of your models? I needed it for an app that required auditing. I had ActiveRecord call backs on the audited models to create audit entries on every record operation. The problem was that the models had no access to the currently logged in user. (more…)

Continue Reading...

24 Aug 2008, Posted by Jo Hund in Ruby/Rails, 7 Comments

Recipe: RESTful permissions for Rails


A common requirement for Rails applications is to check permissions for certain actions on your RESTful application’s resources. There are many ways to solve this problem, ranging from simple boolean flags to full fledged role based access control. I have tried a lot of approaches and have settled on a fairly simple way that is RESTful and quite flexible.

(more…)

Continue Reading...

10 Aug 2008, Posted by Jo Hund in Ruby/Rails, Tools, 0 Comments

OpenSource project: Quentin Time Tracker


Being a contract software developer, tracking my time is extremely important for my business: I need to write invoices with task break downs, I want to get better at estimating, and I am just curious about what I spend my time on.

So I filled this need by writing my own Rails time tracker: meet Quentin. I cleaned it up a bit and just published it as an MIT-licensed open source project on github.

Quentin dashboard

Quentin dashboard

(more…)

Continue Reading...

06 Aug 2008, Posted by Jo Hund in Software, Tools, 2 Comments

Better TextMate search: Ack in project


Yesterday Trevor mentioned the Ack TextMate bundle he developed to provide better “Search in project”. I installed it and was instantly sold:

  • search is much faster using ack
  • the results list pops up instantly with the first hits, and then it just keeps growing as you start reviewing the results
  • it has an option to show context around the results (see screenshot below)
  • you can customize the search behavior on a per user or per project basis using a .ackrc file
  • it has an option to follow symlinks. Useful for me because I symlink rails into vendor for my apps. Normally I don’t want to include the rails source in my project search
  • search is limited to currently selected file/folder and its children. Useful for scoping searches.

(more…)

Continue Reading...

09 Jul 2008, Posted by Jo Hund in Software, Uncategorized, 1 Comments

Learning Smalltalk (1): Back to the future


I am learning Smalltalk and will document my progress in a series of blog posts. I have heard too many interesting things about it to ignore it any longer. I am hoping to use it for web development and while learning it, to become a better programmer in other languages as well.

(more…)

Continue Reading...

07 Jul 2008, Posted by Jo Hund in Business, Software, 0 Comments

Why writing good code makes sense


Kent Beck in his book “Implementation patterns” explains why it makes business sense to write good code:

Businesses that are able to develop and release with confidence, shift direction in response to opportunities and competition, and maintain positive morale through challenges and setbacks will tend to be more successful than businesses with shoddy, buggy code.

Continue Reading...