*Disclaimer: i'm fairly new to Rails and I don't know whether this would be
desired behavior.*
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
endend
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 quickly seen if we look at
Rails::Generators::NamedBase.namespaced_path which is defined as
def namespaced_path
@namespaced_path ||= namespace.name.split("::").map {|m| m.underscore }[0]end
Shouldn't it be possible two have your models and controllers be namespaced
by multiple namespaces?
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/eeole9orVqgJ.
For more options, visit https://groups.google.com/groups/opt_out.