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.
- Host: GitHub
- URL: https://github.com/amiel/has_metadata_and_delegates
- Owner: amiel
- License: mit
- Created: 2009-10-09T17:56:08.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-10-28T16:04:55.000Z (over 15 years ago)
- Last Synced: 2024-10-03T12:33:10.011Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
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