mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
8606a7fbe9
See #9869 and #9929. The problem arises from the following example: class Project < ActiveRecord::Base scope :completed, -> { where completed: true } end class MajorProject < Project end When calling: MajorProject.where(tasks_count: 10).completed This expands to: MajorProject.where(tasks_count: 10).scoping { MajorProject.completed } However the lambda for the `completed` scope is defined on Project. This means that when it is called, `self` is Project rather than MajorProject. So it expands to: MajorProject.where(tasks_count: 10).scoping { Project.where(completed: true) } Since the scoping was applied on MajorProject, and not Project, this fails to apply the tasks_count condition. The solution is to make scoping apply across STI classes. I am slightly concerned about the possible side-effects of this, but no tests fail and it seems ok. I guess we'll see. |
||
---|---|---|
.. | ||
admin | ||
autoloadable | ||
admin.rb | ||
aircraft.rb | ||
arunit2_model.rb | ||
author.rb | ||
auto_id.rb | ||
binary.rb | ||
bird.rb | ||
book.rb | ||
boolean.rb | ||
bulb.rb | ||
car.rb | ||
categorization.rb | ||
category.rb | ||
citation.rb | ||
club.rb | ||
college.rb | ||
column_name.rb | ||
comment.rb | ||
company.rb | ||
company_in_module.rb | ||
computer.rb | ||
contact.rb | ||
contract.rb | ||
country.rb | ||
course.rb | ||
customer.rb | ||
dashboard.rb | ||
default.rb | ||
developer.rb | ||
dog.rb | ||
dog_lover.rb | ||
edge.rb | ||
electron.rb | ||
engine.rb | ||
entrant.rb | ||
essay.rb | ||
event.rb | ||
eye.rb | ||
face.rb | ||
friendship.rb | ||
guid.rb | ||
interest.rb | ||
invoice.rb | ||
item.rb | ||
job.rb | ||
joke.rb | ||
keyboard.rb | ||
legacy_thing.rb | ||
lesson.rb | ||
line_item.rb | ||
liquid.rb | ||
man.rb | ||
matey.rb | ||
member.rb | ||
member_detail.rb | ||
member_type.rb | ||
membership.rb | ||
minimalistic.rb | ||
minivan.rb | ||
mixed_case_monkey.rb | ||
molecule.rb | ||
movie.rb | ||
order.rb | ||
organization.rb | ||
owner.rb | ||
parrot.rb | ||
person.rb | ||
pet.rb | ||
pirate.rb | ||
possession.rb | ||
post.rb | ||
price_estimate.rb | ||
project.rb | ||
randomly_named_c1.rb | ||
rating.rb | ||
reader.rb | ||
reference.rb | ||
reply.rb | ||
ship.rb | ||
ship_part.rb | ||
shop.rb | ||
speedometer.rb | ||
sponsor.rb | ||
string_key_object.rb | ||
student.rb | ||
subject.rb | ||
subscriber.rb | ||
subscription.rb | ||
tag.rb | ||
tagging.rb | ||
task.rb | ||
topic.rb | ||
toy.rb | ||
traffic_light.rb | ||
treasure.rb | ||
treaty.rb | ||
tyre.rb | ||
vegetables.rb | ||
vertex.rb | ||
warehouse_thing.rb | ||
wheel.rb | ||
without_table.rb | ||
zine.rb |