Migration generator - cannot create base classes with subclasses in one go
Reported by solars | December 13th, 2008 @ 11:38 AM | in Hobo 1.0 - Final
the migration generator doesn't behave like expected with the latest release, and causes errors
Comments and changes to this ticket
-
solars December 14th, 2008 @ 03:32 PM
Happens if you create a subclass of a AR model that has no corresponding table yet (not migrated).
This means that you cannot create base classes with subclasses in one go, I don't really know wether this should generally be possible or not...
AR::Base.descends_from_active_record? breaks it in /hobofields/lib/hobo_fields/migration_generator.rb:47 since it is accessing .columns
-
Tom Locke December 30th, 2008 @ 03:38 PM
- State changed from new to open
I'm not quite sure what the solution is here. Here's the method in question.
def descends_from_active_record? if superclass.abstract_class? superclass.descends_from_active_record? else superclass == Base || !columns_hash.include?(inheritance_column) end end
What happens in ActiveRecord when the model has a superclass before it gets back to AR::Base, but there is no inheritance column? I didn't know that was allowed. What table names would be used? Do you know? : )
-
Tom Locke January 6th, 2009 @ 04:57 PM
- Milestone set to Hobo 1.0 - Final
-
Tom Locke January 6th, 2009 @ 05:19 PM
- Tag changed from generator, hobo_migration, models to defect, generator, hobo_migration, models
- Title changed from Inheritance is broken again to Migration generator - cannot create base classes with subclasses in one go
-
Tom Locke November 30th, 2009 @ 11:59 PM
- State changed from open to resolved
(from [a91c0bd0e03770a575bf2f17b097e7f43080f445]) [#345 state:resolved] handle creating STI base along with subclasses in migration generator http://github.com/tablatom/hobo/commit/a91c0bd0e03770a575bf2f17b097...
-
Matt Jones December 1st, 2009 @ 12:49 AM
The only case this doesn't handle well is CTI (Class Table Inheritance) with a non-abstract base. Note that this case pretty much makes Rails execute an HCF as well: https://rails.lighthouseapp.com/projects/8994/tickets/3484
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Referenced by
- 345 Migration generator - cannot create base classes with subclasses in one go (from [a91c0bd0e03770a575bf2f17b097e7f43080f445]) [#345 s...