Routing issue

Hi all

I’m having finding it difficult finding the proper way to route some
pages in my application. The application follows the rest architecture
and is closed for non authorized persons.

But their are some publicly available pages (normal content pages).
These content pages are build dynamically. All the content comes from
the database as the page structure. You could compare it to a basic cms.

So viewing the page list, editing / creating and deleting gets done by
normal REST principles

edit_pages_path() => /en/pages/:id/edit
new_page_path() => /en/pages/new

and are only accessible for the authorized people.

But the show action is where the content of the page is shown and is
viewable by everyone. The only difference is, that the URL should look
like this:

/en/page-title

So the controller name should not be visible for the viewers. Using the
page title isn’t such a big deal. Instead of using page_path(object), I
put page_path(:id => object.title) . The only downside is that the URL
that gets rendered is /en/pages/page-title . So the controller name is
visible.

I have tryed using the :as option in the route, but that just results in
double slashes en even not being able to use the controller name for the
other actions.

map.resources :pages, :as => “” , :path_prefix => ‘/:locale’,

I know this should be possible, since other rails cms are able the
achieve this. Or maybe its not because the application is restful. I
hope their is someone here who could help me out and point me in the
right direction.

Thank you in advance

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs