Skip to content

Commit

Permalink
add ar associations monkey patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebaker committed May 21, 2013
1 parent af12928 commit 0674e11
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/rails23_ruby193_ar_associations_monkey_patch.rb
@@ -0,0 +1,13 @@
# Finally, we have this innocuous looking patch. Without it, queries like this: current_account.tickets.recent.count
# would instantiate AR objects all (!!) tickets in the account, not merely return a count of the recent ones.
# See https://rails.lighthouseapp.com/projects/8994/tickets/5410-multiple-database-queries-when-chaining-named-scopes-with-rails-238-and-ruby-192
# (The patch in that lighthouse bug was not, in fact, merged in).
module ActiveRecord
module Associations
class AssociationProxy
def respond_to_missing?(meth, incl_priv)
false
end
end
end
end

0 comments on commit 0674e11

Please sign in to comment.