Fix association class name for namespaced has one model lookups
Use association.klass.name instead of association.class_name to get the namespaced class name and therefore prevent: `Object.get_const(association_class_name)` from raising "uninitialized constant ParanoidHasOne" in the following situation: module Something def self.table_name_prefix "something_" end class ParanoidHasOne < ActiveRecord::Base acts_as_paranoid has_one :paranoid_belongs_to, dependent: :destroy end class ParanoidBelongsTo < ActiveRecord::Base acts_as_paranoid belongs_to :paranoid_has_one end end hasOne = Namespaced::ParanoidHasOne.create hasOne.destroy hasOne.restore(:recursive => true) # previously would explode
Showing
Please
register
or
sign in
to comment