Forum: Rails Engines Namespace problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A6cd05d51f0a40a56a1c235620ebdfec?d=identicon&s=25 Bart Masschelein (Guest)
on 2006-05-09 22:14
(Received via mailing list)
Hello,

I wanted to convert an Engine (in casu the RikiEngine) into namespaces,
to avoid naming clashes. I did this as I thought it should be done: I
created in the view, model and controller directory seperate riki_engine
directories, and renamed the classes to for instance

class RikiEngine::LibraryController < ApplicationController

Everything seems to work, but until I try to access a method which is
defined in the riki_engine directory under lib (the
riki_engine_helper.rb). In there things are defined as:

module RikiEngine
  def foo
  end
end

When I call foo from a controller method, or from within a view, it is
unknown, whereas previously, there was no problem. So obviously there is
a namespace problem here. I tried several things, without success.
Mainly because I don't get the bottom line of namespace yet. Can
somebody shed a light on this problem, if only the solution?

And related to this problem, what is the opinion on putting engines
immediately in their own namespace? Don't get me wrong, I don't mind
doing it manually, and I can imagine that automating this might be more
difficult, in comparison to the two minutes of doing it manually.

Thanks!

Bart
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-05-14 23:36
(Received via mailing list)
It's very unlikely that there will ever be any kind of 'automatic
namespacing' provided with by the Engines plugin; less magic and
behaviour which is consistent with the rest of Rails is always
preferable.
This topic is locked and can not be replied to.