Hello guys, found this issue in version 3.0.7, just working in the
same site with 3.0.10 and the same issue pops out.
Lets say we have a Classified site, so we have ads and pictures:
class Ad < ActiveRecord::Base
scope :active, where(“expires_on > now()”)
scope :unsold, where(“sold = 0”)
scope :approved, where("status = “approved”)
class Picture < ActiveRecord::Base
Now lets run some tests and try to explain myself:
adsWHERE (sold = 0) ORDER BY ads.created_at
=> NoMethodError: undefined method `there_is_no_scope’ for #<Class:
Awesome. Now comes the issue
I have 1.6M of records in my ads table, obviously I noted some kind of
hanging, the problem was,
Ad.includes(:picture).there_is_no_scope.unsolds.to_sql raise the
NoMethodError but also executes the query defined before the missing
scope, in this case “select * from ads”.
I can create an example application if this is not understandable.
Just want you guys to know about this issue.