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

skorks.com

Ctrl + R Search commands you entered previously. Press Ctrl + R again to search further back, Ctrl + Shift + R searches forward...

alfajango.com

Thanks to habits engrained by Rails 2’s link_to_remote and remote_form_for, we expect that Rails 3...

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

blog.jcoglan.com

Terminus is a Capybara driver where most of the driver functions are implemented in client-side JavaScript. It lets you...

github.com

Sometimes you inherit a non Rails or non Rack based web app such as PHP, Perl, Java / JEE, etc. I...

Use this MySQL command to show further info about a table: SHOW CREATE TABLE tags; This will output a table...

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...

This returns the name (including path) of your current layout: response.layout => "layouts/admin" # inside views that are using the 'admin' layout...

When doing a presentation you may want to hide your desktop icons. You can switch them off (or back on...

After switching to Rails 3 you may get a LoadError with the following message when trying to use your application...

You might find that your Passenger ignores all RailsSomething directives in the vhost for your new Rails 3 application. The...

You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to...

Be careful when using params.merge as params is a HashWithIndifferentAccess. Why? Usually this should not be an issue but it...

In rare cases you might need something like form_for (for using form builder methods on the resulting block element...

I prefer the application that I'm currently working on to be reachable at http://localhost/. So when I switch...

Be careful when memoizing a method that returns a scope, e.g.: def variants scoped(:conditions => { :name => name }) end memoize :variants...

When using form_for you can give the form's target URL either as a string or an array:

trentrichardson.com

The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker (jQueryUI) is required for using any of...

kalzumeus.com

I’m going to list assumptions your systems probably make about names. All of these assumptions are wrong. Try to...

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 need to look at the list of methods that are called upon certain events (like before/after saving etc...