Skip to content
Browse files

tidy up formatting

  • Loading branch information...
1 parent 2fdb521 commit 851fd8f57257eaa244289007a0919ba32be00036 @jonleighton jonleighton committed Mar 4, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 activerecord/lib/active_record/model_schema.rb
View
21 activerecord/lib/active_record/model_schema.rb
@@ -115,16 +115,17 @@ def table_name
# the documentation for ActiveRecord::Base#table_name.
def table_name=(value)
value = value && value.to_s
+
if defined?(@table_name)
return if value == @table_name
-
reset_column_information
end
- @table_name = value
- @quoted_table_name = nil
- @arel_table = nil
- @sequence_name = nil unless defined?(@explicitly_sequence_name) && @explicitly_sequence_name
- @relation = Relation.new(self, arel_table)
+
+ @table_name = value
+ @quoted_table_name = nil
+ @arel_table = nil
+ @sequence_name = nil unless defined?(@explicit_sequence_name) && @explicit_sequence_name
+ @relation = Relation.new(self, arel_table)
end
# Returns a quoted version of the table name, used to construct SQL statements.
@@ -170,8 +171,8 @@ def sequence_name
end
def reset_sequence_name #:nodoc:
- @sequence_name = connection.default_sequence_name(table_name, primary_key)
- @explicitly_sequence_name = false
+ @sequence_name = connection.default_sequence_name(table_name, primary_key)
+ @explicit_sequence_name = false
end
# Sets the name of the sequence to use when generating ids to the given
@@ -189,8 +190,8 @@ def reset_sequence_name #:nodoc:
# self.sequence_name = "projectseq" # default would have been "project_seq"
# end
def sequence_name=(value)
- @sequence_name = value.to_s
- @explicitly_sequence_name = true
+ @sequence_name = value.to_s
+ @explicit_sequence_name = true
end
# Indicates whether the table associated with this class exists

0 comments on commit 851fd8f

Please sign in to comment.
Something went wrong with that request. Please try again.