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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:05:10+00:00 2026-05-25T00:05:10+00:00

This has been fixed. I guess I had left :method => put in the

  • 0

This has been fixed. I guess I had left :method => put in the form helper when I copied it from another view I had written. False alarm.

I have a route in my rails 3 application that shows up in ‘rake routes’ but ends up raising a no route matches error.

I am attempting to create a namespaced route for creating and adding new users under a company that the current_user manages. The namespace is ‘company’. The controller that should handle this operation is the ‘users_controller’ and is located inside of the controllers->company folder.

My routes.rb file contains this code:

namespace :company do
  resources :users
  resources :manage, :only => [:show,:edit,:update]
end

devise_for :users

My users_controller.rb under the app->controllers->company folder contains this code:

def new
  @user = current_user.company.users.new
end

def create
  @user = current_user.company.users.create(params[:user])
  if @user.save
    flash[:notice] = "Successfully Added New User"
    redirect_to company_path(current_user.company.id)
  else
    flash[:warn] = "Correct Errors and Resubmit"
   # render :action => 'new'
  end
end

The view for the create action under app->views->company->users->create.html.erb contains:

<h2>Adding User for <%= current_user.company.name %></h2>

<%= form_for(@user, :url => company_users_path) do |f| %>


  <p><%= f.label :email %><br />
  <%= f.email_field :email %></p>

  <p><%= f.label :first_name %><br />
  <%= f.text_field :first_name %></p>

  <p><%= f.label :last_name %><br />
  <%= f.text_field :last_name %></p>

  <p><%= f.label :password, "New Password" %><br />
    <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation, "Confirm New Password" %><br />
    <%= f.password_field :password_confirmation %></p>

  <p><%= f.submit "Add User" %></p>
<% end %>

<%= link_to "Back", :back %>

And finally when I run the ‘rake routes’ command I get this:

company_users     GET    /company/users(.:format)           {:action=>"index",    :controller=>"company/users"}
                  POST   /company/users(.:format)           {:action=>"create", :controller=>"company/users"}
new_company_user  GET    /company/users/new(.:format)       {:action=>"new", :controller=>"company/users"}
edit_company_user GET    /company/users/:id/edit(.:format)  {:action=>"edit", :controller=>"company/users"}
company_user      GET    /company/users/:id(.:format)       {:action=>"show", :controller=>"company/users"}
                  PUT    /company/users/:id(.:format)       {:action=>"update", :controller=>"company/users"}
                  DELETE /company/users/:id(.:format)       {:action=>"destroy", :controller=>"company/users"}

The ‘new’ action renders just fine. The error which I receive after submitting the form is:

Routing Error

No route matches "/company/users

I am using the devise gem for authentication and can provide more details about my application if need be. So far everything else I have added works great. I am guessing it has something to do with how I am defining the namespace. I am still fairly new to rails and this is my first attempt at namespace routing.

I apologize if I provided too much information or too little. Any help is greatly appreciated.

  • 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-25T00:05:11+00:00Added an answer on May 25, 2026 at 12:05 am

    Try to change the form_for to:

    form_for([:company,@user])
    

    It should work. See http://guides.rubyonrails.org/form_helpers.html#dealing-with-namespaces

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

Sidebar

Related Questions

Edit : The bug that caused this problem has been fixed. The @version tag
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
EDIT : As of 2012-06-11 this bug has been finally fixed! https://bugs.webkit.org/show_bug.cgi?id=35981#c1 I have
I know this question has been fixed a lot of time, but I didn't
Edit: The bug which prompted this question has now been fixed . In the
Update: This was a bug which has been fixed by now (Chrome 18). I
EDIT : This issue has been fixed by google in gtest 1.4.0; see the
This has been a problem that I haven't been able to figure out for
This has been an adventure. I started with the looping duplicate query located in
This has been driving me crazy for a few days. Why doesn't the following

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.