Problems with `inverse` #234

tillsc opened this Issue Dec 18, 2012 · 0 comments


None yet
1 participant

tillsc commented Dec 18, 2012

The automatic detection of inverse relationships seems a little error-prone to me. It heavily depends upon the usage of symbols in :child_key Options. Example:

class A
  belongs_to :b

class B
  has n, :as, :child_key => 'b_id'

In this case the inverse would be generated (ignoring the existing one) because of :child_key being a String.

The Bug is located here:

 ["b_id"].send(:==, [:b_id]) # => false

This problem prevents the specification of DB constraints other then :protect (the default for automatically generated inverse relationships) when using Strings instead of Symbols in :child_key options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment