Note that there are some explanatory texts on larger screens.

plurals
  1. PORails routes for particular setup
    text
    copied!<p>I am new to rails and have a question on how to best route my particular application. I am using a legacy database so the schema is already set and complicates things a bit. The layout of the app includes a top navigation bar that includes 'users' and then for a particular 'user' there is another navigation bar to display/edit a variety of forms. For example once a particular 'user' is queried there are seperate forms for 'general information' and 'account information', etc. </p> <p>The setup I have now is to have a 'users' namespace to correspond to the top level navigation and in the namespace have the second level of navigation: 'general', 'project', etc. With this setup each form selected from the second level of navigation has its own controller which seems a bit odd. </p> <pre><code> namespace :users do resources :general, :project end </code></pre> <p>This allows me to have the following urls where :id belongs to 'user'</p> <pre><code>/users/general/:id /users/general/:id/edit /users/account/:id /users/account/:id/edit </code></pre> <p>Does this seem reasonable or does anyone have any other ideas on how to deal with a nested navigation setup in a RESTful way? The legacy database complicates in that I do not have a 'general','account' model or DB table. For each form I need to pull from several models/tables that have associations with the 'user' model. Having a 'general' controller while not having a 'general' model does not seem very rails like which is what is bothering me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload