Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 480 Bytes

README.rdoc

File metadata and controls

18 lines (11 loc) · 480 Bytes

denormalize-field

Postgres only as of 0.2

Denormalizes fields in ActiveRecord models in order to avoid SQL joins and hydrating Ruby Objects to obtain a simple fields.

Usage

class Post < ActiveRecord::Base
  belongs_to :category
  denormalizes :category => :name
end

category = Category.create(:name => "News")
post     = Post.create(:category => category)

post.category_name # "News"  (you have to create the migration to add Post#category_name manually)