Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hooopo/redundant_column
redundant_column
https://github.com/hooopo/redundant_column
Last synced: 26 days ago
JSON representation
redundant_column
- Host: GitHub
- URL: https://github.com/hooopo/redundant_column
- Owner: hooopo
- License: mit
- Created: 2012-07-02T10:26:18.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-07-12T18:36:50.000Z (over 12 years ago)
- Last Synced: 2024-10-08T01:28:44.364Z (about 1 month ago)
- Language: Ruby
- Size: 98.6 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RedundantColumn
Auto maintain the consistency of redundant column.
1. Auto update redundant column.
2. Auto fill redundant column value from redundant target object.## Installation
Add this line to your application's Gemfile:
gem 'redundant_column'
And then execute:
$ bundle
Or install it yourself as:
$ gem install redundant_column
## Usage
class User < ActiveRecord::Base
has_many :topics, :redundant_column => {:status => :user_status}
endclass Topic < ActiveRecord::Base
belongs_to :user, :redundant_column => {:user_status => :status}
enduser = User.create(:name => "Hooopo", :status => "active")
topic = Topic.create(:user => user, :title => "this is title")
assert_equal topic.user_status, user.status
user.status = "disable"
user.savetopic.reload
assert_equal topic.user_status, user.status
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request