Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to call destroy on Citier subtype #49

Open
ianpetzer opened this issue Jan 5, 2012 · 2 comments
Open

Unable to call destroy on Citier subtype #49

ianpetzer opened this issue Jan 5, 2012 · 2 comments

Comments

@ianpetzer
Copy link

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 #ActiveRecord::Relation:0x00000100ea89f8

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 [email protected]_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
@wmarbut
Copy link

wmarbut commented Jan 8, 2012

Jumping on this bandwagon, I get the same error when I try to delete an item.

undefined local variable or method `bind_values' for #<ActiveRecord::Relation

@wmarbut
Copy link

wmarbut commented Jan 16, 2012

So this seems to be an issue with using older versions of rails 3. I bumped up to 3.1.3 and it works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants