Created
January 12, 2012 14:32
-
-
Save ugisozols/1600844 to your computer and use it in GitHub Desktop.
Refinery::Blog routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refinery::Core::Engine.routes.draw do | |
# frontend | |
namespace :blog do | |
root :to => "posts#index" | |
resources :posts | |
end | |
# backend | |
namespace :blog, :path => "" do | |
namespace :admin, :path => "refinery/blog" do | |
root :to => "posts#index" | |
resources :posts | |
end | |
end | |
end | |
# refinery.blog_posts_path - frontend | |
# refinery.blog_admin_posts_path - backend |
Thank you for the explanation. I believe I understand the plan now. How long do you think it will take to get the new namespacing stable for core and the different engines like blog. I'm trying to deploy a reasonably current version of the code to a rails 3.1 site now, but have tripped over a few of the recent commits to core that have broken blog.
It all depends how much time we get to spend on it :-) it's not our
day jobs so it's all spare time effort. We depend on contributors.
Maybe a week of full time effort involved.
I am getting up to speed on the code, but I'm afraid this might be too comprehensive a change for me to be very helpful. I'm not pushing just asking, and I'm happy to help where I can.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isolate_namespace sets engine name (this can be overridden by using engine_name method), default scope for its routes, prefixes db tables and some other things so you're right about helper which allows main app or other engines to access blog routes but I'll emphasize once more the fact that we're adding blog routes to Refinery::Core and this way all those routes will be accesible using refinery helper (refinery is the name of Core engine).
Mount point of the engine becomes its root path so if we mount blog engine at
/blog
then we can't access its backend stuff from/refinery/blog
- we would have to use/blog/refinery/blog
so for example usingrefinery_blog.admin_posts_path
would produce url/blog/refinery/blog
.isolate_namespace :refinery
makes sense for one model engines like images, resources. Blog engine has multiple models and therefor db tables should be named likerefinery_blog_posts
,refinery_blog_categories
- isolate_namespace sets those prefixes for us.I know this is not a 1:1 explanation so please let me know if I left something out or was unclear.