#888 ✓resolved
Betelgeuse

In Hobo has_one :through thinks it's an Array

Reported by Betelgeuse | December 20th, 2010 @ 05:09 PM | in Hobo 1.0X

Given associations:

  belongs_to :parent
  has_one :parent_parent, :through => :parent

In this case we get:

>> t.parent_parent.class
=> ParentParent
>> t.parent_parent.is_a?(Array)
=> true

Faulty code found via debugger:

[31, 40] in /usr/local/lib/ruby/gems/1.8/gems/hobo-1.0.2/lib/active_record/association_collection.rb
   31          proxy_respond_to?(args) || Array.new.respond_to?(args)
   32        end
   33
34 # TODO: send this patch into Rails. There's no reason to load the collection just to find out it acts like an array. 35 def is_a?(klass) => 36 [].is_a?(klass) 37 end 38
39 def member_class 40 proxy_reflection.klass

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Referenced by

Pages