21 Jul '13, 1pm

"ActiveRecord Refactoring: Move Association Behavior to Associated Class"

In a typical Rails app, one ActiveRecord model tends to accumulate a lot of associations and related methods. This is usually the User class; e.g., the User has many posts, comments, contacts, projects, etc. It’s also common to have a few instance methods to filter these associations, e.g., User#unpublished_posts , or User#recent_contacts . Soon this God class becomes overwhelmed by all of these responsibilities. The intent of this refactoring is to move this behavior to the associated class. Knowing Too Much The following ActiveRecord model has a few associations (to keep this example simple), and an instance method to filter one of them. class User User#active_projects seems to know too much about the domain's concept of an active project. Let's move it to the Project class. Moving Responsibilities User#active_projects can be converted to a class method on Project . clas...

Full article: http://pivotallabs.com/activerecord-refactoring-move-asso...

Tweets

So you want to be a programmer? by Bryan Goldst...

pivotallabs.com 21 Jul '13, 6pm

I have been asked by at least a few people if I could tell them the best way to get started with programming and I have be...

New coffee class dates posted:

New coffee class dates posted:

cafegrumpy.com 02 Aug '13, 7pm

Join the Made In NYC team for a networking event. Coffee and pastries will be provided in the café garden. Hear about what...

"@perrynnx_: Typical class in Singapore

twitter.com 01 Aug '13, 12pm

When you tweet with a location, Twitter stores that location. You can switch location on/off before each Tweet and always ...

New post: Geometry class just got augmented

New post: Geometry class just got augmented

hackaday.com 26 Jul '13, 5pm

Hmm, I am somewhat sceptical that this is an actual video of the device working and not only a proof-of-concept, pre-recor...