This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
MIT-LICENSE | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
default_association_attributes.gemspec | ||
| |
lib/ | ||
| |
test/ |
README.rdoc
DefaultAssociationAttributes
Because sometimes all you want to say is
@subscriber.invitations.build
For more motivation, see the blog post, matthewtodd.org/2009/03/02/default-association-attributes-in-active_record.html
Installation
As a gem:
config.gem 'matthewtodd-default_association_attributes', :lib => 'default_association_attributes', :source => 'http://gems.github.com'
As a plugin:
script/plugin install git://github.com/matthewtodd/default_association_attributes.git
Usage
In your model:
class Subscriber < ActiveRecord::Base
has_many :invitations, :extend => DefaultAssociationAttributes do
def default_attributes
{ :email => proxy_owner.email }
end
end
end
Copyright © 2009 Matthew Todd, released under the MIT license








