Namespace problem

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

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs