Created
January 20, 2015 03:19
-
-
Save pdswan/9cfe2c6328727fe00119 to your computer and use it in GitHub Desktop.
The search for #union
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[6] pry(main)> left = User.where(name: "Bill") | |
User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."name" = $1 [["name", "Bill"]] | |
=> [] | |
[7] pry(main)> $ left.union | |
Error: Couldn't locate a definition for left.union! | |
[8] pry(main)> left.respond_to?(:union) | |
=> true | |
[9] pry(main)> $ left.method_missing | |
From: /Users/pdswan/code/scratch/rails4_union/rails4/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb @ line 91: | |
Owner: ActiveRecord::Delegation::ClassSpecificRelation | |
Visibility: protected | |
Number of lines: 11 | |
def method_missing(method, *args, &block) | |
if @klass.respond_to?(method) | |
self.class.delegate_to_scoped_klass(method) | |
scoping { @klass.public_send(method, *args, &block) } | |
elsif arel.respond_to?(method) | |
self.class.delegate method, :to => :arel | |
arel.public_send(method, *args, &block) | |
else | |
super | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment