Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }

This note describes how to setup a box running Ubuntu to share its Internet connection with another PC.

If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...

apidock.com

You can now add an :inverse_of option to has_one, has_many and belongs_to associations.... Without :inverse_of...

If you previously used version 2.x of Thunderbird and upgraded to 3.x (for example through an Ubuntu release...

github.com

The ancestry gem allows you to easily use tree structures in your Rails application. There is one somewhat unobvious pitfall...

If you did file operations inside a shell or for example using Nautilus, it can take quite a while until...

When you do tags with acts-as-taggable-on and want to preload associated tags, you can do so with...

Note: We are talking about Machinist 1 here, Machinist 2 may have solved this or might require a different approach...

If you want to see how long your database queries actually take, you need to disable MySQL's query cache...

timetobleed.com

This post will describe how I stumbled upon a code path in the Linux kernel which allows external programs to...

makandra dev
ruby-doc.org

[ ] [ ]= ** ! ~ + - * / % + - >> << & ^ | <= < > >= <=> == === != =~ !~ && || .. ... ? : = %= { /= -= += |= &= >>= <<= *= &&= ||= **= defined? not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's...

These steps are now part of Spreewald. This note describes a Cucumber step that lets you write this:

makandra dev

Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11

You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...

We use RTeX for PDF exports. While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions...

makandra dev

You don't need a Rails application to use Sass. Even when you're working on a static site you...

beust.com

It’s pretty common for projects hosted on GitHub to receive “pull requests”: requests from people who have cloned your...

When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...

You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...

First of all: You could just use RVM which would make the pain go away. If for some reason you...

github.com

You can use the whatlanguage gem to detect the language of a Ruby string. Note that it also has not...

wmd-editor.com

WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD...

Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit...