Describe the bug
I am using rom-rb with rom-sql and rom-factory.
In short, a struct creation via factory (Factory.structs[:foo]) is not using default type value unless schema also has unrelated jsonb type field.
Took me forever to isolate the source of issue to that jsonb type column 😅
To Reproduce
Example repo:
https://github.com/trafium/rom_factory_bug
To run:
bundle exec rake db:create
bundle exec rake db:migrate
ruby test.rb
The output is:
#<Entities::Foo column_with_default=nil id=1 random_column=nil>
#<Entities::Bar column_with_default="default" id=1 random_column=nil>
Expected behavior
#<Entities::Foo column_with_default="default" id=1 random_column=nil>
#<Entities::Bar column_with_default="default" id=1 random_column=nil>
I am not sure what is the expected behaviour for rom-factory, but I would expect it should always use default values for factory structs creation.
My environment
- Affects my production application: Not yet
- Ruby version: 2.6.6
- OS: MacOS 11.2.3
Describe the bug
I am using rom-rb with rom-sql and rom-factory.
In short, a struct creation via factory (
Factory.structs[:foo]) is not using default type value unless schema also has unrelatedjsonbtype field.Took me forever to isolate the source of issue to that
jsonbtype column 😅To Reproduce
Example repo:
https://github.com/trafium/rom_factory_bug
To run:
The output is:
Expected behavior
I am not sure what is the expected behaviour for
rom-factory, but I would expect it should always use default values for factory structs creation.My environment