diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/engine.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 0620b8608e..ababf6a242 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -333,21 +333,22 @@ module Rails def namespace(mod) engine_name(generate_railtie_name(mod)) - _railtie = self name = engine_name - mod.singleton_class.instance_eval do - define_method(:_railtie) do - _railtie - end - - define_method(:table_name_prefix) do - "#{name}_" - end - end - self.routes.default_scope = {:module => name} - self.namespaced = true + + unless mod.respond_to?(:_railtie) + _railtie = self + mod.singleton_class.instance_eval do + define_method(:_railtie) do + _railtie + end + + define_method(:table_name_prefix) do + "#{name}_" + end + end + end end def namespaced? |