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 740957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:34:36+00:00 2026-05-14T08:34:36+00:00

So I am creating a website that I want to have an admin directory

  • 0

So I am creating a website that I want to have an admin directory in rails 1.8.x and I’m struggling a bit to get the form_for to link to the right controller. I am trying to be RESTful. What I basically want is an admin page that has a summary of actions which can then administer sub models such as:

/admin (a summary of events)
/admin/sales (edit sales on the site)
/admin/sales/0 (the normal RESTful stuff)

I can’t use namespaces since they were introduced in Rails 2.0 (production site that I don’t want to mess with updating rails and all that).

Anyway, what I have in the routes.rb is:

map.resource :admin do |admin|
  admin.resources :sales
end

I am using the map.resource as a singleton as recommended by another site.

The problem comes in when I try to use the form_for to link to the subresource RESTfully. If i do :

form_for(:sales, @sale)

it never links to the right controller no matter what I try. I have also tried:

form_for [@admin, @sale] do |f|

and that does not work either (I am guessing since admin is a singleton which does not have a model, it’s just a placeholder for the admin controller). Am I supposed to add a prefix or something? Or something into the sales controller to specify that it is a subcontroller to admin? Is there an easier way to do this without manually creating a bunch of routes? Thanks for any help.

  • 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-05-14T08:34:37+00:00Added an answer on May 14, 2026 at 8:34 am

    You can use controller, action and html options something like following.

    <%= form_for :sales, :controller=>controllerName, :action=>actionName, :id=>idParameter}, :html=>{:onsubmit=>"someFunction()"} do |f| %>
    
    
                |
                |
                |
    
    
    
    
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website that right now, runs by creating static html pages from
I'm creating a website that will have the admin upload documents available only to
I have folders on a website I am creating that I only want logged
i'm creating a shopping website. i have a gridview that is bound to an
I'm creating a website that interfaces with a .mdb database. I have a field
I have a website that I want to deploy to a clients DEV and
I'm creating a website with rails that sells a virtual service, and therefore don't
I am creating a website that has 5 different sub-sites each with the same
I am creating a website that uses a fluid layout with artificial columns. I
I'm creating a website that has both commenting and voting systems. I wanted to

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.