You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made you a lil repro script. The child without foreign key is created just fine, the child with foreign key hits an exception.
require"bundler/inline"gemfiledosource"https://rubygems.org"gem"sqlite3"gem"combustion"gem"with_model"gem"minitest"endrequire"combustion"require"minitest/autorun"require"with_model"# A hack to override some Combustion behaviormoduleBundlerdefself.require(*)# noopendendENV['DATABASE_URL']="sqlite3::memory:"ENV['RAILS_ENV']="test"Combustion.initialize!:active_record,database_reset: false,load_schema: falsedoconfig.enable_reloading=trueendWithModel.runner=:minitestclassForeignKeysSpec < Minitest::SpecextendWithModelwith_model:Parentdomodeldohas_many:childrenhas_many:children_with_foreign_key,class_name: "ChildWithForeignKey"endendwith_model:Childdotabledo |t|
t.references:parentendmodeldobelongs_to:parentendendwith_model:ChildWithForeignKeydotabledo |t|
t.references:parent,foreign_key: trueendmodeldobelongs_to:parentendendit"creates a child without a foreign key"doparent=Parent.create!child=parent.children.create!assert_equalparent,child.parentendit"creates a child with a foreign key"doparent=Parent.create!assert_raisesActiveRecord::StatementInvaliddoparent.children_with_foreign_key.create!endendend
The text was updated successfully, but these errors were encountered:
I made you a lil repro script. The child without foreign key is created just fine, the child with foreign key hits an exception.
The text was updated successfully, but these errors were encountered: