citier
citier copied to clipboard
The citier view won't reflect further changes on the tables
The citier view won't reflect further changes on the tables. So if you add a new column on the superclass or base class table, the views won't reflect this change. Here are some options we have to workaround this:
- Call create_citier_view / drop_citier_view after any change on the related tables. Even then, you will have to call ClassName.reset_column_information() to clear the rails columns cache
- Create an update_citier_view method and call it after all related tables change.
- Find a way to hookup the tables changes and fire some update method to sync the citrier view
- Make the citier view dynamic, but I really don't know how to do this :P
What you think about it guys?
I'm not so good with database stuff.. (I'm really an iPhone dev toying with Rails)
I like this gem so gonna keep plugging away at it and try to iron out some problems.
Regarding this issue...
How about an initial patch to combine drop + create into an update method? This could also call .reset_column_information()
Once we've got this start to look at automation?
OK I've added a method to drop and create in my fork
Yep agreed. I've checked your pull request and I think you forgot to call the reset method :) You'll also have to call this method in the superclass.
ha! Yes I did. Bugger. Call it in both current class and any of it's supers?
Well I'm not sure :) For current class I think you should call in its superclass (just one level), but for an update in the superclass I think you should call for its any subclasses. In Ruby 1.9 you can get the class's subclasses in this way:
ObjectSpace.each_object(Class).select { |c| c < MyClass }
What do you think?