Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Joshua Kovach's Profile

GitHub User: shekibobo

Site: http://www.friendswithpants.net

Comments by Joshua Kovach

Avatar

Actually had this problem in a project a while back. Ended up using a UUID as the property's hash key, but using a display_name when displaying them, allowing the field names to change without breaking the rest of it. It was complicated, though, and I'm not sure doing so would work well with Hstore. It did add a few extra layers of abstraction and wasn't very fun to work with. @phillyslick also makes a good point that deleting fields doesn't delete the data from the properties hash. The only way we found to work around that was to update all the items of a certain type if the type changed.

This is a great cast, but in my experience doing this kind of thing can bring you down a pretty slippery slope if the users aren't warned of the consequences. With great flexibility comes great responsibility, and diligence and well tested rake tasks should be built into the system.

Avatar

@ewall - thanks for the code on making this work with BBQ (post 34). It works great.

@Ryan - Big fan of your Railscasts. Thanks a ton!