An open API service indexing awesome lists of open source software.

https://github.com/amiel/has_metadata_and_delegates

Delegates methods to a metadata association, and automatically creates it if necessary.
https://github.com/amiel/has_metadata_and_delegates

Last synced: 11 months ago
JSON representation

Delegates methods to a metadata association, and automatically creates it if necessary.

Awesome Lists containing this project

README

          

= Has Metadata And Delegates

Delegates methods to a metadata association, and automatically creates it if necessary.

== Example

class User < ActiveRecord::Base
has_one :metadata, :class_name => 'UserMetadata'
has_metadata_and_delegates :invite_count, :'foobar*'
end

class UserMetadata < ActiveRecord::Base
end

User.first.metadata_without_creation # => nil
User.first.foobar = 'blah'
User.first.metadata.foobar # => 'blah'

== Rails Versions

This plugin is known to work in versions of rails 2.x. It has not been tested in rails 3.

Please let me know what experience you have if you try this with rails 3.

Copyright (c) 2009 Amiel Martin, released under the MIT license