petehamilton / citier

CITIER (Class Inheritance & Table Inheritance Embeddings for Rails) is a solution for simple Multiple Class Inheritance in Rails.
88 stars 24 forks source link

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

Open educobuci opened 13 years ago

educobuci commented 13 years ago

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:

What you think about it guys?

morgz commented 13 years ago

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 commented 13 years ago

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

educobuci commented 13 years ago

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.

morgz commented 13 years ago

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

educobuci commented 13 years ago

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?