Skip to content

Commit

Permalink
change referenced of #scoped to #scope
Browse files Browse the repository at this point in the history
  • Loading branch information
codeodor committed Mar 20, 2013
1 parent 28431b2 commit 8d582e5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Expand Up @@ -8,7 +8,7 @@ def delete_records(records, method)
else
# CPK
# keys = records.map { |r| r[reflection.association_primary_key] }
# scope = scoped.where(reflection.association_primary_key => keys)
# scope = scope.where(reflection.association_primary_key => keys)
table = Arel::Table.new(reflection.table_name)
and_conditions = records.map do |record|
eq_conditions = Array(reflection.association_primary_key).map do |name|
Expand All @@ -22,7 +22,7 @@ def delete_records(records, method)
condition = condition.or(and_condition)
end

scope = scoped.where(condition)
scope = scope.where(condition)

if method == :delete_all
update_counter(-scope.delete_all)
Expand Down
Expand Up @@ -4,9 +4,9 @@ class Preloader
class Association
def records_for(ids)
# CPK
# scoped.where(association_key.in(ids))
# scope.where(association_key.in(ids))
predicate = cpk_in_predicate(table, reflection.foreign_key, ids)
scoped.where(predicate)
scope.where(predicate)
end

def associated_records_by_owner
Expand Down
Expand Up @@ -5,7 +5,7 @@ class BelongsTo
def records_for(ids)
# CPK
predicate = cpk_in_predicate(table, association_key_name, ids)
scoped.where(predicate)
scope.where(predicate)
end
end
end
Expand Down
Expand Up @@ -6,7 +6,7 @@ def records_for(ids)
# CPK
#scope = super
predicate = cpk_in_predicate(join_table, reflection.foreign_key, ids)
scope = scoped.where(predicate)
scope = scope.where(predicate)

klass.connection.select_all(scope.arel.to_sql, 'SQL', scope.bind_values)
end
Expand Down

0 comments on commit 8d582e5

Please sign in to comment.