Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:25:58+00:00 2026-06-01T17:25:58+00:00

Here is a app contorller directory from Rails project doing a self study for

  • 0

Here is a app contorller directory from Rails project

**app controller directory**

doing a self study for rails, but from what I understand if I create a directory in the app folder then I have to do the complete the routes files with a match that route like:

match "/editor/usynkdataeditor/saveusynkeditor",

Question to the community is there a better way that I can define different directory structure for a specific workflow or is it safe to define all the controllers in parent controllers directory.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:25:59+00:00Added an answer on June 1, 2026 at 5:25 pm

    If you create additional directory in controllers directory, you are effectively namespacing your controllers.

    So this controller would be:

    class Editor::UsynkdataeditorController < ApplicationController
      def saveusynkeditor
      end
    end
    

    As far as routes are defined, you can do something like:

    MyApplication::Application.routes.draw do
    
      namespace :editor do
        get "usynkdataeditor/saveusynkeditor"
      end
    
    end
    

    Whish will give you route:

    $ rake routes
    editor_usynkdataeditor_saveusynkeditor GET /editor/usynkdataeditor/saveusynkeditor(.:format) editor/usynkdataeditor#saveusynkeditor
    

    Or, preferably just use restful routes instead of saveusynkeditor like this:

    MyApplication::Application.routes.draw do
    
      namespace :editor do
        resources :usynkdataeditor do
          collection do
            get :saveusynkeditor
          end
        end
      end
    
    end
    

    when you will get:

    $ rake routes
    saveusynkeditor_editor_usynkdataeditor_index GET    /editor/usynkdataeditor/saveusynkeditor(.:format) editor/usynkdataeditor#saveusynkeditor
                    editor_usynkdataeditor_index GET    /editor/usynkdataeditor(.:format)                 editor/usynkdataeditor#index
                                                 POST   /editor/usynkdataeditor(.:format)                 editor/usynkdataeditor#create
                      new_editor_usynkdataeditor GET    /editor/usynkdataeditor/new(.:format)             editor/usynkdataeditor#new
                     edit_editor_usynkdataeditor GET    /editor/usynkdataeditor/:id/edit(.:format)        editor/usynkdataeditor#edit
                          editor_usynkdataeditor GET    /editor/usynkdataeditor/:id(.:format)             editor/usynkdataeditor#show
                                                 PUT    /editor/usynkdataeditor/:id(.:format)             editor/usynkdataeditor#update
                                                 DELETE /editor/usynkdataeditor/:id(.:format)             editor/usynkdataeditor#destroy
    

    There is a really good explanation http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing of what you are trying to achieve in rails guides.

    Finally, to answer your question:

    1. Better way? Well it’s up to your preferences. How do you like your code organized? You can use namespacing but you don’t have to. However,
    2. at the same there is nothing wrong with having all controllers in parent controller directory.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the line from App.Config: <add key=CheckFileFormatString value=P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}/> Here's the code that puts
Here is my project structure: /app --/lib ----/porter.rb --/spec ----/porter_spec.rb In file porter_spec.rb i
I've split my rails app into a admin directory and a public directory. The
Ok, here's one for the JavaScript gurus: In my app, one of the controllers
i've a jquery (UI) App here where the whole JQuery Code gets a little
Here is my app.js: Ext.application({ views: ['SignIn'], launch: function() { // Initialize the signin
I have a question here regarding iPhone app submission. I have a free application
This is a continuation of the question here: JBoss - does app have to
Here is the scenario: I'm writing an app that will watch for any changes
Here's part of my Django app's models.py : class Person(models.Model): birth_year = WideYear(null=True, blank=True)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.