Skip to content
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

Using AR::Base.none in subquery results with no condition unexpectedly #15176

Closed
PikachuEXE opened this issue May 19, 2014 · 7 comments
Closed

Comments

@PikachuEXE
Copy link
Contributor

Listing.none.count => 0

Expected:
Parent.listings.where(id: Listing.none).count => 0

Actual:
Parent.listings.where(id: Listing.none).count => all_record_count

@senny
Copy link
Member

senny commented May 19, 2014

@PikachuEXE can you please attach an executable test-case to reproduce? You can use this script as a starting point.

@PikachuEXE
Copy link
Contributor Author

OK here it is:
http://pastebin.com/VGRrQYHq
All 3 are failing

@senny
Copy link
Member

senny commented May 19, 2014

thank you 💛 l

@rails-bot
Copy link

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Rails team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

@PikachuEXE
Copy link
Contributor Author

@senny Do you have all the information you need?
@rails-bot pings me :P

@guigs
Copy link
Contributor

guigs commented Aug 27, 2014

I'm experiencing this issue too! I'm using where('1 = 0') as a workaround.

@jrproctor
Copy link

I am also using the same where('1 = 0') workaround in my project to avoid this bug

senny added a commit to senny/rails that referenced this issue Sep 11, 2014
@senny senny closed this as completed in 16868b5 Sep 11, 2014
trungpham pushed a commit to trungpham/rails that referenced this issue Sep 18, 2014
[Matthew Draper & Yves Senn]

Closes rails#16860. (pull request to discuss the implementation)
senny added a commit that referenced this issue Feb 11, 2015
[Matthew Draper & Yves Senn]

Closes #16860.

Conflicts:
	activerecord/CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants