### What is this PR?
* Add detail re: customizing column names.
### Why is it required?
Because it may not be convenient to name the column: 'ancestry' - I imagine (perhaps incorrectly) that many would prefer to customize the column name to something better suited to their use-cases (e.g. https://github.com/stefankroes/ancestry/issues/273).
I hope this change is helpful - if it is not, feel free to close without compunction etc.
Active record works better when defining a class rather than using anonymous classes
The with_model helper takes care of all the details.
A few of the STI examples did not properly handle undefining these temporary classes.
This PR properly undefines the temporary test classes
was running into issues with pre-validation callbacks.
they were running a bunch of queries and requiring columns to be
in the model when we were only focused on the ancestry columns
this fixes that
before:
- run all prevalidation call backs
- run all validations
- check that ancestry did not thow an exception
after:
- run only ancestry validations
also consolidates 2 different ancestry checks
much like we do with parent, if the root_id is invalid, then we continue on
as if nothing has happened wrong.
It was hard to decide what to return but returning self seems like the best option.
the order of nulls relative to columns with values is setup as
a default value in databases, which can be changed. The default for
postgres is to have nulls last. Looks like oracle has the same.
This PR has oracle enhanced driver follow suite as postgres.
Postgres and rails 6.0 and earlier had issues with the null first, so this is
feature limited to 6.1 and later
since rails around 5.1, mysql2 has been the only supported driver.
We dropped support for the old mysql driver, but left the travis configuration in there by mistake
this is just cleaning that out
instead mysql and mysql2 use mysql2 driver
Most database ship with locales built in so they are consistent across installations.
Postgres does not ship with locales so it uses the ones in the operating system.
In the locales there is collation, which basically defines how to sort. We will mostly
notice this in the following 2 ways:
- case sensitive sorting
- include symbols in the sorting
case sensitive: "B", "E", "c", "d"
non-case Insensitive: "B", "c", "d", "E"
include symbols: "Sams Golf Shop", "Sam's Cantina"
ignore symbols: "Sam's Cantina", "Sams Golf Shop"
In our domain, the ignoring symbols causes some issues:
include symbols: "1/2/3", "1/2/5", "1/4", "12/4"
ignore symbols: "1/2/3", "12/4", "1/2/5", "1/4" (think alphabetic sort: "123", "125", "14", 124")
If you are ordering them to put into a tree, then this gets confusing and
can result in children coming back out of order. This is tricky for arrange.
An option was introduced for the case when symbols are not considered. It essentially
'join' the strings together to simulate ignoring the symbols.
Also do remember, that this is sorting alphabetically rather than numerically. So 14 > 123.