hzamani / acts_as_relation

Multi table Inheritance for rails
http://hzamani.github.com/acts_as_relation/
MIT License
180 stars 58 forks source link

Nested use with factory girl causes `Segmentation fault` #49

Open oleander opened 11 years ago

oleander commented 11 years ago

I've this structure.

class StaticPlaylist < ActiveRecord::Base
  acts_as_superclass
end

class ImportedPlaylist < ActiveRecord::Base
  acts_as :static_playlist
  acts_as_superclass
end

class DigiPlaylist < ActiveRecord::Base
  acts_as :imported_playlist
end

When I try creating a DigiPlaylist using factory girl I get this error.

<ruby-root>/gems/acts_as_relation-1.0.0/lib/active_record/acts_as_relation.rb:83: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
<ruby-root>/gems/acts_as_relation-1.0.0/lib/active_record/acts_as_relation.rb:83: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

Here is the full stacktrace. It looks like an infinitive loop.

My factory looks like this.

FactoryGirl.define do
  factory(:digi_playlist) do
  end
end

I looks like the problem is explained in pull request #8.

endless loop at time of creation in some cases (as example creation through Factory Girl Proxy)

How can we solve this?