Displaying 2 results from an estimated 2 matches for "isolate_namespace".
2011 Apr 06
1
Time to fix PartialRenderer#partial_path
...e/things/
_thing.html.erb. I can see the advantage of that (if you want
different partial for @thing in your admin namespace) but I think the
disadvantage of being unable to reuse your partials is too big
(especially with other code using your engine).
module Foo
class Engine < Rails::Engine; isolate_namespace Foo; end
class ApplicationController < ActionController::Base; end
class Thing < ActiveRecord::Base; end
end
Foo::Thing.connection.create_table(:foo_things)
Foo::ApplicationController.new.view_context._partial_renderer.send(:partial_path,
Foo::Thing.new)
=> "foo/foo/things/thing&...
2011 Jul 25
3
Rails 3.1 Engines: Full vs. Mountable
...do
# whatever
end
- No namespacing of models, controllers, etc. These are immediately
accessible to the parent application.
** Mountable Engine **
- The engine''s namespace is isolated by default.
# my_engine/lib/my_engine/engine.rb
module MyEngine
class Engine < Rails::Engine
isolate_namespace MyEngine
end
end
- With a mountable engine, the routes are namespaced and the parent
app can bundle this functionality under a single route:
# my_engine/config/routes.rb
MyEngine::Engine.routes.draw do
#whatever
end
# parent_app/config/routes.rb
Rails.application.routes.draw do
mount MyEngin...