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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:44:56+00:00 2026-05-27T06:44:56+00:00

when I visit ‘company/new’, then I get the following error: undefined method `companies_path’ Extracted

  • 0

when I visit ‘company/new’, then I get the following error:

undefined method `companies_path'
Extracted source (around line #1):
1: <%= form_for(@company) do |f| %>

But when I visit ‘company/1/edit’ (which uses the same form) everything works fine.
This is the company controller for ‘new’ and ‘edit’:

def new
  @company = Company.new
end
def edit
  @company = Company.find(params[:id])
end

And this is (part of) the form:

<%= form_for(@company) do |f| %>
<!-- Show errors -->
<%= render('layouts/form_errors', :object => @company) %>

I really don’t understand the error message, because ‘companies_path’ is not being used in the code?

Update: here is the routes.rb:

  get "users_dashboard/show"
  get "login" => "sessions#new", :as => "login" 
  get "logout" => "sessions#destroy", :as => "logout"

  resources :company
  resources :relations
  resources :activities
  resources :contacts
  resources :notes
  resources :tasks
  resources :users
  resources :sessions

  get "site/index"
  get "site/features"
  get "site/dashboard"

  root :to => 'users_dashboard#show'

And here is the company model:

class Company < ActiveRecord::Base
has_many :users
has_many :relations
has_many :contacts, :through => :relations
has_many :notes, :through => :contacts
has_many :tasks, :through => :contacts
has_one :subscription

accepts_nested_attributes_for :subscription

attr_accessible :name, :address1, :address2, :zipcode, :city, :country, :email,      :website, :telephone, :twitter, :linkedin, :code

validates       :name, :address1, :zipcode, :city, :country, :code, presence: true
validates_length_of :code, :maximum => 3

end

  • 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-27T06:44:56+00:00Added an answer on May 27, 2026 at 6:44 am

    You should change

    resources :company
    

    to

    resources :companies
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I visit my browser this is what i get: Fatal error: Declaration of
If you visit this link right now, you will probably get a VBScript error.
I get this error when I visit myapp/feed in my browser: NoMethodError in Konkurrancers#feed
I'm trying to visit a page with cucumber, with: visit new_video_path but I get
When I visit a site I built some time ago in IE, I get
If you visit the following link, it may be easier to understand what I
If I visit my site with out the www. prefix, login and then add
Sometimes I visit a website with Chrome and get a message that I need
If you visit my script page.php in the URL. A 500 Error appears. If
Please visit the following page with Firefox or any other browser AND Internet Explorer:

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.