Hi folks, In writing an engine, it seems to me that I'd want to put all my model and controller classes within a namespace, to avoid name clashes with similarly named classes in the base application, or other engines. By namespaces, I mean wrap the class in a module.
For example, I'm writing a forum engine, and I have two models. Forum::Thread Forum::Comment And I've called their tables in the database: forum_threads forum_comments I think this will prevent clashes nicelly, and rails handles it by creating a /views/forum/ directory for my views. This all works fine as a rails app, and it runs fine too when I move it into an engine, except for loading fixtures in tests. Rails does not have support for looking in a sub directory of "fixtures", so i need to call my fixture files: forum_threads.yml forum_comments.yml Then, I do the following in my test case: fixtures :forum_threads, :forum_comments set_fixture_class :forum_comments => Forum::Comment set_fixture_class :forum_threads => Forum::Thread This works in a normal rails app, but not in an engine. All my tests do something like this: 1) Error: test_create_replaces_form_if_invalid(Forum::ThreadControllerTest): FixtureClassNotFound: The class "ForumThread" was not found. method find in fixtures.rb at line 403 method instantiate_fixtures in testing_extensions.rb at line 86 method instantiate_fixtures in testing_extensions.rb at line 85 method silence in base.rb at line 794 method instantiate_fixtures in testing_extensions.rb at line 84 method instantiate_fixtures in testing_extensions.rb at line 317 method instantiate_fixtures in testing_extensions.rb at line 316 method setup_with_fixtures in fixtures.rb at line 525 method setup in fixtures.rb at line 547 Does anyone know of any difference in the way that namespaces (nested modules) work in engines compared to normal apps? I'm using rails 1.1.6 cheers, Craig www.craigambrose.com _______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
