Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Denormalize Fields in ActiveRecord Objects
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
denormalize-field.gemspec

README.rdoc

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)
Something went wrong with that request. Please try again.