PeterHamilton/citier — Issue #49: Unable to call destroy on Citier subtype
Author: ianpetzer
Created: 2012-01-05 11:00:14+00:00
State: open

When I call destroy on a book in the citier demo app, I get the following error:

undefined local variable or method `bind_values' for #

This appears to originate from the following method in the Relation class.

alias_method :relation_delete_all, :delete_all
def delete_all(conditions = nil)
return relation_delete_all(conditions) if !@klass.acts_as_citier?

return relation_delete_all(conditions) if conditions

deleted = true
ids = nil
c = @klass

bind_values.each do |bind_value|
if bind_value[0].name == "id"
ids = bind_value[1]
break
end
end
ids ||= where_values_hash["id"] || where_values_hash[:id]
where_hash = ids ? { :id => ids } : nil

deleted &= c.base_class.where(where_hash).relation_delete_all
while c.superclass != ActiveRecord::Base
if c.const_defined?(:Writable)
citier_debug("Deleting back up hierarchy #{c}")
deleted &= c::Writable.where(where_hash).delete_all
end
c = c.superclass
end

deleted
end