Does attributes order matter on creation?
Hi,
I'm a little confused with this bug. First some code:
class Company < ActiveRecord::Base
acts_as :entity
has_many :company_markets
has_many :markets, through: :company_markets
def market_ids
# getter for market_ids
end
def market_ids=
# setter for market_ids
end
end
class Entity < ActiveRecord::Base
# as a name attribute
actable
end
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.
It is a bug. And PR is welcome :-)
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!