-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hey, I'm having trouble with good_migrations in a migration where one of the classes has a polymorphic association. Just wondering if anyone has hit this issue before, or has any tips?
Here's a rough example of what it looks like:
class MigrateWidgets < ActiveRecord::Migration[5.2]
class Widget < ActiveRecord::Base
belongs_to :poly, polymorphic: true
end
class Foo < ActiveRecord::Base; end
class Bar < ActiveRecord::Base; end
def up
# Example 1; GoodMigrations::LoadError (attempting to load app/models/foo.rb)
Widget.where(poly_type: 'Foo').includes(:poly).find_each do |widget|
# ...
end
# Example 2; GoodMigrations::LoadError (attempting to load app/models/bar.rb)
Widget.where(poly_type: 'Bar').last.poly
end
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels