citier icon indicating copy to clipboard operation
citier copied to clipboard

The citier view won't reflect further changes on the tables

Open educobuci opened this issue 13 years ago • 5 comments

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?

educobuci avatar Jul 07 '11 19:07 educobuci

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?

morgz avatar Jul 08 '11 10:07 morgz

OK I've added a method to drop and create in my fork

morgz avatar Jul 08 '11 12:07 morgz

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.

educobuci avatar Jul 08 '11 14:07 educobuci

ha! Yes I did. Bugger. Call it in both current class and any of it's supers?

morgz avatar Jul 08 '11 14:07 morgz

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?

educobuci avatar Jul 08 '11 15:07 educobuci