Note that there are some explanatory texts on larger screens.

plurals
  1. PO"undefined method `companies_path'" error
    text
    copied!<p>when I visit 'company/new', then I get the following error:</p> <pre><code>undefined method `companies_path' Extracted source (around line #1): 1: &lt;%= form_for(@company) do |f| %&gt; </code></pre> <p>But when I visit 'company/1/edit' (which uses the same form) everything works fine. This is the company controller for 'new' and 'edit':</p> <pre><code>def new @company = Company.new end def edit @company = Company.find(params[:id]) end </code></pre> <p>And this is (part of) the form:</p> <pre><code>&lt;%= form_for(@company) do |f| %&gt; &lt;!-- Show errors --&gt; &lt;%= render('layouts/form_errors', :object =&gt; @company) %&gt; </code></pre> <p>I really don't understand the error message, because 'companies_path' is not being used in the code?</p> <p>Update: here is the routes.rb:</p> <pre><code> get "users_dashboard/show" get "login" =&gt; "sessions#new", :as =&gt; "login" get "logout" =&gt; "sessions#destroy", :as =&gt; "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 =&gt; 'users_dashboard#show' </code></pre> <p>And here is the company model:</p> <pre><code>class Company &lt; ActiveRecord::Base has_many :users has_many :relations has_many :contacts, :through =&gt; :relations has_many :notes, :through =&gt; :contacts has_many :tasks, :through =&gt; :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 =&gt; 3 </code></pre> <p>end</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload