Casecommons / pg_search

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search
http://www.casebook.net
MIT License
1.35k stars 371 forks source link

Handle composite primary keys in scopes #537

Open causztic opened 4 months ago

causztic commented 4 months ago

Fixes https://github.com/Casecommons/pg_search/issues/531

nertzy commented 3 months ago

A good place to start would be to set up something in the spec/integration directory following the general pattern there. I think making a new file such as spec/integration/composite_primary_key_spec.rb may be a good approach.

The test should set up a model / DB table using with_model and with a pg_search_scope applied. It should perform some queries against the model and assert that the correct results are returned.

If we have this level of testing, then I think that the more specific "unit"-level specs are more optional and only really needed if there is some complex or surprising behavior in one of the specific implementation classes.

nertzy commented 3 months ago

You can also run rake standard:fix to fix the code formatting issues that are being triggered.

Good luck, and thanks for this contribution.

causztic commented 3 months ago

@nertzy before e1fd67d I attempted to test when both the model AND the association have composite primary keys, and quickly realised that we need some more changes on association.rb to make it work

Could we leave that for a future PR?

causztic commented 1 day ago

@nertzy checking in ICYMI!