I want to make an Engine that is isolated by two namespaces. That is,
let say for example I''d like to make an Engine whose classes all live
in:
Car::BMW
And thus, my models for example should be placed in:
app/models/car/bmw/
And my tables should be prefixed by for example:
car_bmw_
I tried to accomplish this by having this code in lib/car/bmw/engine.rb
module Car
module BMW
class Engine < ::Rails::Engine
isolate_namespace Car::BMW # This will call: engine_name
''car_bmw''
end
end
end
With this code whenever I generate a model however, the model is placed
in:
app/models/car
And the table is prefixed by:
car_
The reason for this can be found in
Rails::Generators::NamedBase.namespaced_path:
def namespaced_path
@namespaced_path ||= namespace.name.split("::").map {|m|
m.underscore
}[0]
end
Which, as you can see, takes only the first part of the namespace. Does
anyone know why this is? Am I not supposed to doubly namespace models
and controllers or is this a bug?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.