aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/through_association.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-24 19:28:53 +0000
committerJon Leighton <j@jonathanleighton.com>2011-01-30 11:56:41 +0000
commit15601c52e7c7094a6b7b54ef8acfc8299a4d6724 (patch)
tree7581198609598406e92df33ef24d8a4df8f4314a /activerecord/lib/active_record/associations/through_association.rb
parent63c73dd0214188dc91442db538e141e30ec3b1b9 (diff)
downloadrails-15601c52e7c7094a6b7b54ef8acfc8299a4d6724.tar.gz
rails-15601c52e7c7094a6b7b54ef8acfc8299a4d6724.tar.bz2
rails-15601c52e7c7094a6b7b54ef8acfc8299a4d6724.zip
Let's be less blasé about method visibility on association proxies
Diffstat (limited to 'activerecord/lib/active_record/associations/through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/through_association.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb
index d2112fb2b6..9c62ace4fb 100644
--- a/activerecord/lib/active_record/associations/through_association.rb
+++ b/activerecord/lib/active_record/associations/through_association.rb
@@ -3,6 +3,13 @@ module ActiveRecord
module Associations
module ThroughAssociation
+ def conditions
+ @conditions = build_conditions unless defined?(@conditions)
+ @conditions
+ end
+
+ alias_method :sql_conditions, :conditions
+
protected
def target_scope
@@ -17,6 +24,8 @@ module ActiveRecord
scope
end
+ private
+
# This scope affects the creation of the associated records (not the join records). At the
# moment we only support creating on a :through association when the source reflection is a
# belongs_to. Thus it's not necessary to set a foreign key on the associated record(s), so
@@ -92,11 +101,6 @@ module ActiveRecord
join_attributes
end
- def conditions
- @conditions = build_conditions unless defined?(@conditions)
- @conditions
- end
-
def build_conditions
through_conditions = build_through_conditions
source_conditions = @reflection.source_reflection.options[:conditions]
@@ -127,8 +131,6 @@ module ActiveRecord
@reflection.through_reflection.klass.send(:type_condition).to_sql
end
- alias_method :sql_conditions, :conditions
-
def stale_state
if @reflection.through_reflection.macro == :belongs_to
@owner[@reflection.through_reflection.foreign_key].to_s