Skip to content

Stylitics/denormalize-field

 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%