Skip to content

Find by bug#21

Merged
doliveirakn merged 4 commits intomasterfrom
find-by-bug
Jun 25, 2019
Merged

Find by bug#21
doliveirakn merged 4 commits intomasterfrom
find-by-bug

Conversation

@doliveirakn
Copy link
Copy Markdown
Contributor

Message I received

However we found that it causes some problems with .where or .find_by methods. Using your example from the ReadMe for the gem it'd look like:

Picture.where(imageable: Product.find(10))

this generates sql like:
SELECT * from pictures WHERE imageable_type = 0 AND imageable_id = 10;

Do you know why this happened? We expect to have a sql like:
SELECT * from pictures WHERE imageable_type = 2 AND imageable_id = 10;

so basically the imageable_type is wrong. Do you know how to fix this?

This PR adds a spec around the issue, a new monkey patch that fixes it, as well as cleans up some general things to make development easier and show that we are supporting Rails 5

@doliveirakn doliveirakn merged commit 20c19c5 into master Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant