module Forum
class Post < ActiveRecord::Base
acts_as_tree :order => 'created_at'
end
end
$ ./script/console
Loading development environment (Rails 2.0.2)
>> Forum::Post.create().children.create()
ArgumentError: Forum is not missing constant Post!
The problem seems to be that type_name_with_module('Forum::Post') returns 'Forum::Forum::Post' instead of the expected 'Forum::Post'
I am using the following now, and things seems to work all right:
def type_name_with_module(type_name)
(/^(#{parent.name})?::/ =~ type_name ? type_name : "#{parent.name}::#{type_name}"
# Original code
#(/^::/ =~ type_name) ? type_name : "#{parent.name}::#{type_name}"
end