aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2013-04-10 14:33:39 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2013-04-10 14:33:39 -0400
commit070dda28ae1762b9c6a7e40aeeedc5bb57c15147 (patch)
treefe9b3b9a6a2a97e30bdfb36ac1835f5a723446cc /activerecord/lib/active_record/associations/join_dependency
parenteb750e2127d163be46423bcdfc08b420afa58071 (diff)
downloadrails-070dda28ae1762b9c6a7e40aeeedc5bb57c15147.tar.gz
rails-070dda28ae1762b9c6a7e40aeeedc5bb57c15147.tar.bz2
rails-070dda28ae1762b9c6a7e40aeeedc5bb57c15147.zip
rdoc for some of the methods in JoinDependency
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency/join_association.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
index ae1b38ff86..e4d17451dc 100644
--- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb
+++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -123,6 +123,21 @@ module ActiveRecord
manager
end
+ # Builds equality condition.
+ #
+ # Example:
+ #
+ # class Physician < ActiveRecord::Base
+ # has_many :appointments
+ # end
+ #
+ # If I execute `Physician.joins(:appointments).to_a` then
+ # reflection #=> #<ActiveRecord::Reflection::AssociationReflection @macro=:has_many ...>
+ # table #=> #<Arel::Table @name="appointments" ...>
+ # key #=> physician_id
+ # foreign_table #=> #<Arel::Table @name="physicians" ...>
+ # foreign_key #=> id
+ #
def build_constraint(reflection, table, key, foreign_table, foreign_key)
constraint = table[key].eq(foreign_table[foreign_key])