You're probably better off just namespacing 'admin' in your routes.
namespace :admin do
resources :posts
end
Then you'll get "admin/posts" for admin_posts_path
For your controller, you'll just need to prefix the namespace
class Admin::PostsController < ApplicationController
Just remember that you'll need to keep your controllers and views in a
separate 'admin' folder.
Hope this helps.
On Aug 29, 2:08 am, coolesting <coolest...@gmail.com> wrote:
> Hi, everyone,
>
> I set a url as resource :posts, :path => "/admin/posts",
> So, how can i get this partial path like this 'admin' ?
> I just want to get this word 'admin' in controller.
>
> thank you.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment