Message from discussion
Parent::Children controller
Received: by 10.36.134.3 with SMTP id h3mr2454655nzd.1168314462794;
Mon, 08 Jan 2007 19:47:42 -0800 (PST)
Return-Path: <www-d...@server.andreas-s.net>
Received: from server.andreas-s.net (server.andreas-s.net [88.198.17.227])
by mx.google.com with ESMTP id x35si3184770nzg.2007.01.08.19.47.42;
Mon, 08 Jan 2007 19:47:42 -0800 (PST)
Received-SPF: pass (google.com: best guess record for domain of www-d...@server.andreas-s.net designates 88.198.17.227 as permitted sender)
Received: from localhost (localhost [127.0.0.1])
(uid 33)
by server.andreas-s.net with local; Tue, 09 Jan 2007 04:47:41 +0100
id 00094D43.45A3105D.00003762
Date: Tue, 9 Jan 2007 04:47:41 +0100
From: Andrew Skegg <rails-mailing-l...@andreas-s.net>
Sender: list-bou...@example.com
Reply-To: rubyonrails-talk@googlegroups.com
To: rubyonrails-talk@googlegroups.com
Message-Id: <e8b40a4a16ead7a2225627e75e828f90@ruby-forum.com>
In-Reply-To: <1167555026.086402.320970@i12g2000cwa.googlegroups.com>
References: <1167555026.086402.320970@i12g2000cwa.googlegroups.com>
Subject: Re: Parent::Children controller
Content-Type: text/plain; charset=utf-8
Errors-To: list-bou...@example.com
Klaus Paiva wrote:
> Hello!
>
> I'm creating a simple blog to test RoR. I've created an area to manage
> my blog posts by using the "generate controller Admin::Posts". After
> creating my actions, I can acess them by using:
>
> http://localhost:3000/admin/posts/action_here
>
> Everything working till here. But I would like to display a blog
> overview here:
>
> http://localhost:3000/admin/
>
> So I've created an admin controller: "generate controller Admin" and an
> "index" action. The new index action works but, the previous
> posts/action_here not anymore.
>
> I think that when I put /admin/posts on the URL and the controller
> admin exists, I need to tell that I want to use the posts_controller,
> not the admin_controller. Someone knows how can I do that?
>
> Or if someone has a better idea to implement this I'll be grateful!
>
> Thanks for your attention!
One way would be to specify it in the config/routes.rb as such:
map.connect '/admin/posts/:action', :controller => 'posts'
Another might be to create a posts method in the admin controller and
have it redirect to the posts controller (passing all the values
across).
def posts
redirect_to :controller => 'posts', :action => params[:action]
end
There is probably a better way to pass *all* of the params across -
anyone?
--
Posted via http://www.ruby-forum.com/.