ignu / denormalize-field

Denormalize Fields in ActiveRecord Objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

About

Denormalize Fields in ActiveRecord Objects

License:MIT License


Languages

Language:Ruby 100.0%