lib/consul/power.rb in consul-0.6.1 vs lib/consul/power.rb in consul-0.7.0

- old
+ new

@@ -76,10 +76,14 @@ def boolean_or_nil?(value) [TrueClass, FalseClass, NilClass].include?(value.class) end + def database_touched + # spy for tests + end + module ClassMethods def power(*names, &block) names.each do |name| define_power(name, &block) @@ -162,12 +166,11 @@ define_method("#{name.to_s.singularize}?") { |*args| include?(name, *args) } define_method("#{name.to_s.singularize}!") { |*args| include!(name, *args) } ids_method = power_ids_name(name) define_method(ids_method) do |*args| scope = send(name, *args) - scope = scope.scoped(:select => "`#{scope.table_name}`.`id`") - query = Util.scope_to_sql(scope) - ::ActiveRecord::Base.connection.select_values(query).collect(&:to_i) + database_touched + scope.collect_ids end memoize ids_method name end