From 62dd1d8d23c843fa4839e47b9e67d84c15a61f35 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 14 Jul 2010 17:53:03 -0700 Subject: clean up ||= with an initialized variable and attr_reader --- activerecord/lib/active_record/associations.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 65daa8ffbe..9fe8d54f02 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1965,7 +1965,7 @@ module ActiveRecord end class JoinAssociation < JoinBase # :nodoc: - attr_reader :reflection, :parent, :aliased_table_name, :aliased_prefix, :aliased_join_table_name, :parent_table_name + attr_reader :reflection, :parent, :aliased_table_name, :aliased_prefix, :aliased_join_table_name, :parent_table_name, :join_class delegate :options, :klass, :through_reflection, :source_reflection, :to => :reflection def initialize(reflection, join_dependency, parent = nil) @@ -1982,6 +1982,7 @@ module ActiveRecord @parent_table_name = parent.active_record.table_name @aliased_table_name = aliased_table_name_for(table_name) @join = nil + @join_class = Arel::InnerJoin if reflection.macro == :has_and_belongs_to_many @aliased_join_table_name = aliased_table_name_for(reflection.options[:join_table], "_join") @@ -2004,10 +2005,6 @@ module ActiveRecord end end - def join_class - @join_class ||= Arel::InnerJoin - end - def with_join_class(join_class) @join_class = join_class self -- cgit v1.2.3