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'm a little confused with this bug. First some code:
classCompany < ActiveRecord::Baseacts_as:entityhas_many:company_marketshas_many:markets,through: :company_marketsdefmarket_ids# getter for market_idsenddefmarket_ids=# setter for market_idsendendclassEntity < ActiveRecord::Base# as a name attributeactableend
I should also add I have a non-null constraint on the entity.name database table row.
Now the confusion:
Company.create(market_ids: [1, 2], name: 'test') will fail throwing PG::NotNullViolation: ERROR: null value in column "name" violates not-null constraint meaning the entity was created without the name I gave it.
But Company.create(name: 'test', market_ids: [1, 2]) will work. Huh?
So I was curious if that a normal behaviour or not. If not I could look at the code and do a PR. Let me know.
The text was updated successfully, but these errors were encountered:
I have actually decided to change my DB design and won't need this gem anymore. So I won't work on the PR but will leave this open so you can address it eventually. Thanks for the good work. Cheers!
Hi,
I'm a little confused with this bug. First some code:
I should also add I have a
non-null
constraint on theentity.name
database table row.Now the confusion:
Company.create(market_ids: [1, 2], name: 'test')
will fail throwingPG::NotNullViolation: ERROR: null value in column "name" violates not-null constraint
meaning the entity was created without the name I gave it.But
Company.create(name: 'test', market_ids: [1, 2])
will work. Huh?So I was curious if that a normal behaviour or not. If not I could look at the code and do a PR. Let me know.
The text was updated successfully, but these errors were encountered: