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

  • Home
  • SEARCH
  • 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 7734203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:11:29+00:00 2026-06-01T07:11:29+00:00

I am adding an admin namespace with a few controllers, so our stuff can

  • 0

I am adding an admin namespace with a few controllers, so our stuff can edit contents from the backend.

For example, I have a Book model, and a books_controller allowing guests browse. Now I am adding an admin/books_controller, providing a backend for admins to edit books.

  namespace :admin do
    resources :books, except: :show
  end
  resources: books, only: [:index, :show]

Currently for all the link_to and form_for in the admin_books_controller views, I need to add the namespace :admin like this:

<%= form_for([:admin, @post]) do |f| %>

(in the normal controller it would be form_for(@post))

It gets a bit repetitive, and I am wondering if I can set it somewhere in the admin controller so all the link_to within that controller will route in the admin namespace?

  • 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-01T07:11:30+00:00Added an answer on June 1, 2026 at 7:11 am

    If you scope the model under the namespace, that should automatically be reflected in the form generator.

    So something like rails g model admin/book will generate a book model nested under the admin namespace.

    If you then build a form atop that object, something like form_for Admin::Book.new this should target any appropriately nested routes, such as:

    namespace :admin do
      resources :books
    end
    

    I hope this gives some indication of a direction that you can try out.

    Best regards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're in the process of adding DFS to our network setup and have a
I'm adding an inputbox to my site where I as the admin can enter
We have an admin debug console in our app that lets you enter a
I am considering adding OpenID to our customer facing admin and control panel areas...
I have ADAM set-up & I've written web-services to complete admin tasks like adding
I have placed all my admin controllers inside an Admin folder in Controller folder.
I created a form for adding notes about a customer in our web admin.
I'm having problems rerouting my pages from website.com/controller/action to website.com/admin/controller/action. I tried adding this
I added password to glassfish for admin from localhost:4848 Before adding the password I
Simply put, I'm getting this error in the Product Admin of Magento after adding

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.