Browse files

clean up ||= with an initialized variable and attr_reader

  • Loading branch information...
1 parent 3c300b3 commit 62dd1d8d23c843fa4839e47b9e67d84c15a61f35 @tenderlove tenderlove committed Jul 14, 2010
Showing with 2 additions and 5 deletions.
  1. +2 −5 activerecord/lib/active_record/associations.rb
View
7 activerecord/lib/active_record/associations.rb
@@ -1965,7 +1965,7 @@ def instantiate(row)
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 @@ def initialize(reflection, join_dependency, parent = nil)
@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 @@ def find_parent_in(other_join_dependency)
end
end
- def join_class
- @join_class ||= Arel::InnerJoin
- end
-
def with_join_class(join_class)
@join_class = join_class
self

0 comments on commit 62dd1d8

Please sign in to comment.