[Post summary: new release with support for ActiveRecord Associations]
This project started with an innocent idea as I walked along the street: you could easily write a
find method for composite keys. “What’s the big deal about composite keys?”
I sat down and wrote the
find method. But the crud operations didn’t work: create, update, destroy. So I rewrote them for composite key records. I released a gem on various mailing lists to see if the solution worked for other people. People were able to drop it into their legacy system and get it working instantly, and they were thrilled. Cool.
Support for CRUD is only half the job of adding Composite Primary Key support to ActiveRecords/Rails. The other half of ActiveRecord magic is its wonderful support for Associations:
I wrote the association unit tests first and kept extending ActiveRecords until all the tests worked. [A much quicker edit-n-test method than using the console/irb].
And today I uploaded the latest release of Composite Primary Keys with support for Associations. Install it with
gem install composite_primary_keys and include
require 'composite_primary_keys' in your
environment.rb (for Rails apps) or within your Ruby scripts. Visit http://compositekeys.rubyforge.org for other information.
Let me know if it works for you!
- Composite Primary Keys goes 1.0.0 for Rails 2.1 Two years ago Dave Thomas did a keynote at the...
- map_by_method now works with ActiveRecord associations I was always annoyed that map_by_method was broken for ActiveRecord...
- Dr Nic’s Magic Show at RejectConf2007 Update: there is a patch available for edge rails to...
- Magic Multi-Connections: A “facility in Rails to talk to more than one database at a time” At this point in time thereâ€™s no facility in Rails...
- Magic Models: the Spring collection Over the last few months, we at Dr Nic Magic...