-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle composite primary keys in scopes #537
base: master
Are you sure you want to change the base?
Conversation
A good place to start would be to set up something in the The test should set up a model / DB table using 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. |
You can also run Good luck, and thanks for this contribution. |
t.string :prefix | ||
t.string :postfix | ||
t.string :name | ||
context 'without relations' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be good to call these "associations" instead of "relations" because that's the Rails term for them.
"Relation" has a different meaning in PostgreSQL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include PgSearch::Model | ||
belongs_to :parent, foreign_key: [:parent_first_name, :parent_last_name] | ||
|
||
pg_search_scope :search_parent_hobby, associated_against: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great that you are testing associated_against
, good catch!
Fixes #531