datamapper / dm-is-remixable

dm-is-remixable allow you to create reusable data functionality
http://datamapper.org/
MIT License
13 stars 5 forks source link

dm-is-remixable fails with namespaced models #9

Open lupine opened 13 years ago

lupine commented 13 years ago

Here's a simple testcase:

require 'rubygems'
require 'dm-core'

#  See issue 8 for why I'm doing this
require 'extlib/inflection'
module ActiveSupport
  Inflector = ::Extlib::Inflection
end

require 'dm-is-remixable'

module Test

  module Foo
    include DataMapper::Resource
    is :remixable

    property :id, Serial
  end

  class WorkingFoo
    include DataMapper::Resource
    property :id, Serial
    property :bar_id, Integer
  end

  class Bar
    include DataMapper::Resource
    property :id, Serial
    has n, :working_foos  # Works
    remix n, :foos        # Doesn't work
  end
end

I get: NameError: uninitialized constant Foo from dm-core-1.0.2/lib/dm-core/core_ext/object.rb:13:in full_const_get' from dm-core-1.0.2/lib/dm-core/core_ext/object.rb:10:ineach' from dm-core-1.0.2/lib/dm-core/core_ext/object.rb:10:in full_const_get' from dm-is-remixable-1.0.2/lib/dm-is-remixable/is/remixable.rb:160:inremix'

It might actually be a bug in dm-core, I guess (since we're using full_const_get) - but the has n, :working_foos doesn't raise in the same manner.