0

In my app, there's a seperate admin area to control everything including writing posts. The post routes point inside the admin panel :

resources :posts, path: '/admindashboard/posts'

Now in the normal view, Im trying to display the posts inside the pages controller under the blog action. I have managed to list the posts in the blog. But linking to them and showing individual posts is the problem.

Not : I use a post slug instead of the id.

If I link to the post like this :

<%= link_to post.title, post  %>

It will go to /admindashboard/posts/post-slug. But to access that url, we need to sign in. I need to put it like /blog/post-slug . How to do it? How to add the right action in the pages controller to display individual post pages?

4

1 回答 1

1

我认为你需要这样的命名空间

namespace :admindashboard do
  resources :posts
end
于 2013-02-02T06:57:31.907 回答