Skip to content

Commit

Permalink
code cleanup: fix up misleading member variable name.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronen committed Mar 13, 2013
1 parent 035e767 commit 463d385
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/schema_plus/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class << base

def columns_with_schema_plus #:nodoc:
columns = columns_without_schema_plus
columns.each do |column| column.connection = self end unless @schema_plus_extended_columns
columns.each do |column| column.model = self end unless @schema_plus_extended_columns
columns
end

Expand Down
8 changes: 4 additions & 4 deletions lib/schema_plus/active_record/connection_adapters/column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module ConnectionAdapters
module Column

attr_reader :default_expr
attr_writer :connection # connection gets set by SchemaPlus::ActiveRecord::Base::columns_with_schema_plus
attr_writer :model # model gets set by SchemaPlus::ActiveRecord::Base::columns_with_schema_plus

# Returns the list of IndexDefinition instances for each index that
# refers to this column. Returns an empty list if there are no
# such indexes.
def indexes
@indexes ||= @connection.indexes.select{|index| index.columns.include? self.name}
@indexes ||= @model.indexes.select{|index| index.columns.include? self.name}
end

# If the column is in a unique index, returns a list of names of other columns in
Expand Down Expand Up @@ -53,9 +53,9 @@ def required_on
end

# The default as_jon includes all instance variables. but
# @connection can't be dumped (it contains circular references)
# @model can't be dumped (it contains circular references)
def as_json(options=nil)
instance_values.except "connection"
instance_values.except "model"
end
end
end
Expand Down

0 comments on commit 463d385

Please sign in to comment.