I have an admin panel in my site that I separated into its own ''admin'' subdirectory. I do not know what this is called in Rails, so I have not been able to find any real documentation on it. The problem that I am having is that all calls to functions like link_to return /admin/ as the base of the URL. Ex: <%= link_to ''Link'', :controller => ''home'', :action => ''about'' %> creates: <a href="/admin/home/about">Link</a> or <%= link_to ''Add news'', :controller => ''admin/news'', :action => ''new'' %> creates: <a href="/admin/admin/news/new">Add news</a> Once I am in the admin controller area, how do I ''break out'' into the rest of the site using the Ruby URL generators? Sincerely, Tom Reinhart tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org http://AllTom.com/
Check out the Typo codebase for a sample implementation of putting admin in a separate dir. That''s where I got most of my reference. I''m still too early in the game to offer anything more substantial. steve. On 5/9/05, Tom Reinhart <alltom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Once I am in the admin controller area, how do I ''break out'' into the > rest of the site using the Ruby URL generators?
Take a look at components(http://manuals.rubyonrails.com/read/book/14). Maybe an admin component is what you''re looking for. An alternative is to do something custom in the routes, but I''d be afraid of mixing your admin controllers with your non-admin controllers. One mistake in your code and you''ve got the wrong users accessing the admin. - Philip On 5/8/05, Steve Clarke <sclarke77-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Check out the Typo codebase for a sample implementation of putting > admin in a separate dir. That''s where I got most of my reference. I''m > still too early in the game to offer anything more substantial. > > steve. > > On 5/9/05, Tom Reinhart <alltom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Once I am in the admin controller area, how do I ''break out'' into the > > rest of the site using the Ruby URL generators? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Philip Gatt wrote:>Take a look at components(http://manuals.rubyonrails.com/read/book/14). >Maybe an admin component is what you''re looking for. > >An alternative is to do something custom in the routes, but I''d be >afraid of mixing your admin controllers with your non-admin >controllers. One mistake in your code and you''ve got the wrong users >accessing the admin. > >- Philip > >I was going to ask about this in general... for sites where you have 1 or more ''admin'' type ''applications'' as well as a ''public'' site... where especially for caching... the admin can invalidate cached ''public'' pages... what would people recommend for a breakdown... right now while developing, i''ve just been to entirely sep. installations running on different fcgi process but the time is getting close when i need a real solution. in my case at the moment, both lib and model are shared amongst the various parts but helpers, templates etc differ... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 5/9/05, Philip Gatt <gattster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Take a look at components(http://manuals.rubyonrails.com/read/book/14). > Maybe an admin component is what you''re looking for. > > An alternative is to do something custom in the routes, but I''d be > afraid of mixing your admin controllers with your non-admin > controllers. One mistake in your code and you''ve got the wrong users > accessing the admin.That''s weird---mixing is exactly what I want to do. I redirect users who are not admins away from the pages if they happen to type in an admin URL, and I want people who belong in the admin section to have the same main navigation items across the top as when they are browsing normally. Think glorified account control panel for admins. By "doing something custom in you routes" do you mean something like this?: map.connect ''admin/news/:action'', :controller => ''admin/news'' map.connect ''admin/articles/:action'', :controller => ''admin/articles'' -- etc -- I could handle that, although it does seem odd to have to do all that.> - PhilipSincerely, Tom Reinhart tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org http://AllTom.com/
> That''s weird---mixing is exactly what I want to do. I redirect users > who are not admins away from the pages if they happen to type in an > admin URL, and I want people who belong in the admin section to have > the same main navigation items across the top as when they are > browsing normally. Think glorified account control panel for admins.I see what you''re doing. It''s different than what I had in mind. Usually, my sites have a user logged into the admin area, or the member''s area. They are two different areas.> By "doing something custom in you routes" do you mean something like this?: > > map.connect ''admin/news/:action'', :controller => ''admin/news'' > map.connect ''admin/articles/:action'', :controller => ''admin/articles'' > -- etc -- > > I could handle that, although it does seem odd to have to do all that.That''s what I had in mind. I''m no expert (yet), so there may be a better way.