Commit Graph

811 Commits

Author SHA1 Message Date
Keenan Brock cf6fe14030 use active record or vs arel or 2022-01-05 21:17:36 -05:00
Keenan Brock 9c2a7e92ae
Merge pull request #565 from benkoshy/patch-1
Update README.md
2022-01-05 18:37:11 -05:00
Keenan Brock d33a11b78e
Merge pull request #569 from kbrock/kwargs
ruby 3.0 kwargs warning
2022-01-05 18:36:41 -05:00
Keenan Brock b55397ba4d
Merge pull request #561 from Bizcho/master
Add tree_view method
2022-01-05 18:35:47 -05:00
Keenan Brock 8d7dbdfa71
remove unneeded comments
git history can point people to any issues handled by this pr
2022-01-05 18:35:30 -05:00
Keenan Brock 13a2cec9bf
Merge pull request #570 from kbrock/actions
remove travisyml
2022-01-05 18:32:39 -05:00
Keenan Brock e99fb0760a ruby 3.0 kwargs warning 2022-01-05 18:31:38 -05:00
Keenan Brock e9737dcc87 remove travisyml
using github workflow actions, no need for travis.yml
see .github/workflows/run_test_suite.yml
2022-01-05 18:23:52 -05:00
Keenan Brock 72e1c224b6
Merge pull request #568 from kbrock/assert_nil
assert_nil
2022-01-05 17:27:13 -05:00
Keenan Brock 79abd3391f
Merge pull request #566 from daniloisr/patch-1
Use `ensure` to revert @disable_ancestry_callbacks
2022-01-05 17:27:03 -05:00
Keenan Brock b1f2f687f0
Merge pull request #567 from kbrock/peg_3.0
ensure ruby 3.0 not 3 (which means 3.1)
2022-01-05 17:23:51 -05:00
Keenan Brock 7afdc1eb1c assert_nil 2022-01-05 17:23:22 -05:00
Keenan Brock 38d8acbf56 ensure ruby 3.0 not 3 (which means 3.1) 2022-01-05 17:20:37 -05:00
Danilo Resende 68dcb0bd55 Use `ensure` to revert @disable_ancestry_callbacks 2021-12-28 19:09:09 -03:00
Ben Koshy 43e5c4c2fd
Update README.md
### 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.
2021-12-28 11:33:20 +11:00
Luis Valdez 46957a5fa0 Add tree_view method 2021-11-22 21:45:33 -07:00
Keenan Brock be5e6d8ed5
Merge pull request #557 from mijoharas/feature-add-docs-on-indexes
Document index and limitation of ancestry column size.
2021-09-07 07:55:24 -04:00
Michael Hauser-Raspe 71c3c73566 Document index and limitation of ancestry column size. 2021-08-16 09:22:36 +01:00
Keenan Brock a85f44853d
Merge pull request #554 from kbrock/v4.0.1
comments for v4.1.0
2021-06-28 13:55:51 -04:00
Keenan Brock 1bbb0a9675 comments for v4.1.0 2021-06-24 23:41:14 -04:00
Keenan Brock 766eb3db0c
Merge pull request #550 from goodproblems/fix-STI-counter-cache
Fix issue with counter cache and STI
2021-06-23 17:35:04 -04:00
Matt Vague 86b84ceec0 Fix issue with counter cache and STI 2021-06-23 09:45:53 -07:00
Keenan Brock 99cbcd3fe2
Merge pull request #553 from kbrock/class_def_fix
fix tests and class definitions
2021-06-14 14:04:22 -04:00
Keenan Brock 317c3ba69e fix tests and class definitions
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
2021-06-14 14:02:17 -04:00
Keenan Brock a90c99075d
Merge pull request #551 from kbrock/more_valid
only run validation on ancestry column
2021-06-14 13:41:08 -04:00
Keenan Brock ef78cbed5c only run validation on ancestry column
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
2021-06-09 09:43:33 -04:00
Keenan Brock 716b2d2d25
Merge pull request #542 from d-m-u/fix_sanity
change the valid check to not only run on the entire object
2021-06-03 12:06:47 -04:00
Keenan Brock b70976f1f4
Merge pull request #541 from kbrock/nulls_first
oracle use NULLS first
2021-05-26 04:10:04 -04:00
Keenan Brock 17c73ba9cc
Merge pull request #546 from kbrock/bad_root
return self if root is invalid
2021-05-26 04:09:34 -04:00
Keenan Brock 57a09f76e6 return self if root is invalid
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.
2021-05-26 04:03:20 -04:00
Keenan Brock c26c2ffbfa oracle use NULLS first
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
2021-05-26 04:02:21 -04:00
Keenan Brock 4d413b22d9
Merge pull request #547 from kbrock/upgrade_rails
Upgrade rails versions
2021-05-26 03:40:06 -04:00
Keenan Brock 57bb1aa4f9 Upgrade rails versions
upgrading to the latest versions of rails
2021-05-26 03:36:17 -04:00
Keenan Brock 1d02551337
Merge pull request #545 from kbrock/remove_overalls
remove coveralls
2021-05-26 03:33:55 -04:00
Keenan Brock 447f17f455 run coverage with ENV["COVERAGE"] 2021-05-26 03:30:00 -04:00
Keenan Brock 460fdff9ba drop mysql(1) driver support
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
2021-05-26 03:30:00 -04:00
Keenan Brock b3eb72f7bb remove travis status 2021-05-26 03:30:00 -04:00
Keenan Brock 97cdc5df13 remove coveralls
getting some errors with coveralls

not really paying attention to these metrics. removing this to simplify the gem dependencies
2021-05-26 03:30:00 -04:00
Keenan Brock a1a2398f07
Merge pull request #548 from kbrock/change_database_connectivity
point to container databases
2021-05-26 03:28:51 -04:00
Keenan Brock 5161639685 Use database from services
We were running containers with databases but also databases locally

- only run the container databases
- ensure database.ci.yml has the same credentials as setup in the workflow
- let the containers create the databases (may roll this back when local is manually set)
- run sqllite and postgres first to give mysql service time to start
- add pauses for postgres and mysql (though only mysql seems to sometimes need it)
- better error message when DB is not found in database.yml

references:

- https://github.com/docker-library/docs/blob/master/postgres
- https://github.com/docker-library/docs/blob/master/mysql
- https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html
2021-05-26 03:23:06 -04:00
Keenan Brock e8f67eab41
Merge pull request #543 from kbrock/collate
introduce COLLATE_SYMBOLS=false to talor test environments
2021-05-24 11:05:25 -04:00
Keenan Brock cd5dc589a6
Merge pull request #544 from kbrock/latest_mysql
upgrade mysql
2021-05-24 11:00:29 -04:00
Keenan Brock 67bb06ef84 introduce COLLATE_SYMBOLS=false to talor test environments
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.
2021-05-21 19:43:42 -04:00
Keenan Brock d7aa7209ec upgrade mysql 2021-05-21 19:30:00 -04:00
d-m-u 824e8e6464 change the valid to not only check the entire object 2021-05-20 11:32:02 -04:00
Keenan Brock 0a1337e41e
Merge pull request #537 from d-m-u/github_actions
[wip] add github actions test skeleton
2021-05-12 17:08:58 -04:00
d-m-u 69f2324d09 add github actions skeleton 2021-05-11 21:14:18 -04:00
Keenan Brock 7f78f812ec
Merge pull request #536 from kbrock/missing_parent
Missing parent
2021-04-20 13:35:49 -04:00
Keenan Brock 3171caf5e8 dont throw error for invalid parent
resolves https://github.com/stefankroes/ancestry/issues/523

if an invalid value is in the parent_id, `parent` will return nil not throw error
2021-04-20 13:28:04 -04:00
Keenan Brock 54e7d64abc set default testing case to rails 6 2021-04-16 13:38:23 -04:00