apidock.com

All columns of a model's database table are automagically available through accessors on the Active Record object.

stackoverflow.com

TL;DR: Variables not declared using var are stored outside the current scope, most likely in the global scope (which...

Rails has generic error messages you can define in your locale .yml files. You may override those application-wide error...

blog.codeclimate.com

Rails’ reputation as a relatively secure Web framework is well deserved. Out-of-the-box, there is protection against many...

Sometimes you might want to limit the number of associated records in a has_many association, but cannot add a...

makandra dev

Ever wondered about the difference between def and define_method? Turns out there are three implicit contexts in Ruby. def...

The following code doesn't work like expected: page.find(css_selector).find(other_css_selector) The second .find will search...

singlepageappbook.com

Great look at the tradeoffs between progressive enhancement with jQuery or similiar, vs. client-side views.

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background

ariejan.net

Rails understands a :limit options when you create columns in a migration. Its meaning depends on the column type, and...

web.archive.org

TL;DR: You should generally use #size to count associated records. size Counts already loaded elements If the association is...

Here is a hacky way to load dumps directly from the source server, without fully copying them over and extracting...

mysqlperformanceblog.com

When MySQL refuses to use your index, there's a number of things that you may be doing wrong. One...

makandracards.com

See attached link for a way to extract the conditions of a named scope in Rails 2.3.

If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent...

rails-sqli.org

This page lists many query methods and options in ActiveRecord which do not sanitize raw SQL arguments and are not...

In our continued quest to extract proven code snippets from makandropedia into tested and upgradable gems, we have released Edge...

The Edge Rider gem gives your relations a method #traverse_association which returns a new relation by "pivoting" around a...

TLDR: Ruby class variables (@@foo) are dangerous in many ways. You should avoid them at all cost. See bottom of...

When creating an ActiveRecord with .new, .create or create!, you cannot set the ID attribute (note: When using Machinist's...

There is a bug in ActiveRecord 2.3.x that leads to changes in nested forms getting lost. class Project < ActiveRecord...

This works well in the simplified case, when your link disappears after it was clicked. Let link_to_remote behave...

rubydoc.info

When you accept a table in your Cucumber step definition, that table object will have the cryptic type Cucumber::Ast...

Defining one callback several times in the same class behaves different in ActiveRecord and ResourceController. While in ActiveRecord the callbacks...