Intridea Blog: Technology, Design, Business

Back to Blog

Get in Touch

You're currently viewing posts tagged with: "best practices"

Polishing Rubies (Part 4): Writing Library Code

Can you believe it? It's actually time to start writing the code for your gem! Now, in this part of the guide you'll be more "on your own" than up to this point. I don't know what kind of open source library you're writing, whether it's an extension to an existing library, a simple utility, or a complex, sprawling project that will change the face of development forever. What I do know, however, is that there are some common things that you may want to do that have community best practices attached.

Read more…

Black Magic Rails: default_scope

By Intridea | September 26, 2011 rails, best practices, debate, default_scope
Medium

In a community where best practices are always being redefined, black magic practices aren't hard to come by. For our first discussion on controversial Rails practices we're focusing on default_scope.

Default Scopes, (Briefly) Explained

A default scope is a Rails method provided by ActiveRecord which allows you to specify conditions for all the finders associated with a particular model. It is commonly used to specify ordering directly in your ActiveRecord model.

Sounds like a fairly good tool, but don't be fooled. Popular opinion dictates that default_scope is at the very least a chaotic good tool, bordering cunningly on the edge of the black magic stratosphere.

Read more…