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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:22:42+00:00 2026-06-11T22:22:42+00:00

I think I’ve tried every single Undefined Method question solutions on StackOverflow but still

  • 0

I think I’ve tried every single “Undefined Method” question solutions on StackOverflow but still haven’t found one that works for my situation…

I have a model named “Has” and I’m thinking that my problem may be related to the “s” on the end of that. I keep getting this error anytime I try to load the has/new url. /has works just fine. Just not new…

undefined method `has_index_path’ for #<#:0x007ff3bbaa8d48>

Has.rb:

class Has < ActiveRecord::Base
  attr_accessible :bathroom_count, :bedroom_count, :neighborhood, :price, :property_type
  belongs_to :trader
end

has_controller.rb:

class HasController < ApplicationController

  def index
    @has = Has.all
  end

  def show
    @has = Has.find(params[:id])
  end

  def new
    @has = Has.new
  end

  def create
    @has = Has.new(params[:has])
    if @has.save
      flash[:success] = "New Listing Created!"
      redirect_to (:back)
    else
      redirect_to (:back)
    end
  end

  def destroy
    @has.destroy
  end
end

view (new.html.erb) (using simple_form, obviously and that’s working just fine on other “new” views”)

<div class="center hero-unit">
<%= simple_form_for (@has) do |f| %>
    <%= f.association :trader%>
    <%= f.input :price %>
    <%= f.input :bathroom_count %>
    <%= f.input :bedroom_count %>
    <%= f.input :property_type %>
    <%= f.input :neighborhood %>
    <%= f.button :submit %>
<% end %>

routes.rb:

Algotest::Application.routes.draw do
  resources :traders
  resources :wants
  resources :has

  root to: 'static_pages#index'

  match '/add_traders', to: 'traders#new'
  match '/traders', to: 'traders#index'
  match '/add_has', to: 'has#new'
  match '/has', to: 'has#index'
  match '/add_wants', to: 'wants#new'
  match '/wants', to: 'wants#index'
end

EDIT: Here’s the rake routes output:

    traders GET    /traders(.:format)          traders#index
            POST   /traders(.:format)          traders#create
     new_trader GET    /traders/new(.:format)      traders#new
    edit_trader GET    /traders/:id/edit(.:format) traders#edit
         trader GET    /traders/:id(.:format)      traders#show
                PUT    /traders/:id(.:format)      traders#update
                DELETE /traders/:id(.:format)      traders#destroy
          wants GET    /wants(.:format)            wants#index
                POST   /wants(.:format)            wants#create
       new_want GET    /wants/new(.:format)        wants#new
      edit_want GET    /wants/:id/edit(.:format)   wants#edit
           want GET    /wants/:id(.:format)        wants#show
                PUT    /wants/:id(.:format)        wants#update
                DELETE /wants/:id(.:format)        wants#destroy
            has GET    /has(.:format)              has#index
                POST   /has(.:format)              has#create
         new_ha GET    /has/new(.:format)          has#new
        edit_ha GET    /has/:id/edit(.:format)     has#edit
             ha GET    /has/:id(.:format)          has#show
                PUT    /has/:id(.:format)          has#update
                DELETE /has/:id(.:format)          has#destroy
           root        /                           static_pages#index
    add_traders        /add_traders(.:format)      traders#new
                       /traders(.:format)          traders#index
        add_has        /add_has(.:format)          has#new
                       /has(.:format)              has#index
      add_wants        /add_wants(.:format)        wants#new
                        /wants(.:format)            wants#index

EDIT 3
New Route after adding the Inflections code snippet. “Has” routes are looking better but now I’m getting this error on any localhost:3000 page

No route matches {:action=>"show", :controller=>"has"}

Here are the new routes:

    traders GET    /traders(.:format)          traders#index
            POST   /traders(.:format)          traders#create
 new_trader GET    /traders/new(.:format)      traders#new
edit_trader GET    /traders/:id/edit(.:format) traders#edit
     trader GET    /traders/:id(.:format)      traders#show
            PUT    /traders/:id(.:format)      traders#update
            DELETE /traders/:id(.:format)      traders#destroy
      wants GET    /wants(.:format)            wants#index
            POST   /wants(.:format)            wants#create
   new_want GET    /wants/new(.:format)        wants#new
  edit_want GET    /wants/:id/edit(.:format)   wants#edit
       want GET    /wants/:id(.:format)        wants#show
            PUT    /wants/:id(.:format)        wants#update
            DELETE /wants/:id(.:format)        wants#destroy
  has_index GET    /has(.:format)              has#index
            POST   /has(.:format)              has#create
    new_has GET    /has/new(.:format)          has#new
   edit_has GET    /has/:id/edit(.:format)     has#edit
        has GET    /has/:id(.:format)          has#show
            PUT    /has/:id(.:format)          has#update
            DELETE /has/:id(.:format)          has#destroy
       root        /                           static_pages#index
add_traders        /add_traders(.:format)      traders#new
                   /traders(.:format)          traders#index
    add_has        /add_has(.:format)          has#new
                   /has(.:format)              has#index
  add_wants        /add_wants(.:format)        wants#new
                   /wants(.:format)            wants#index
  • 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-11T22:22:43+00:00Added an answer on June 11, 2026 at 10:22 pm

    I would suggest using a noun for the name of your resource, but if for some reason you really want to keep the current name, you could use the following hack: trick rails into thinking that the “singular” and “plural” of “has” are the same using the inflector module:

    In configs/initializers/inflections.rb:

    ActiveSupport::Inflector.inflections do |inflect|
      inflect.irregular 'has', 'has'
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this could be a very easy question for you. But I have
I think that asking this might be kind of silly but I'm still wondering
I think I have a basic understanding of this, but am hoping that someone
I think I have found a bug when setting or getting the Me.Top property
I think it will be very hard for you to read the code but
Think of the following services on one box: SOCKS proxy HTTP proxy SSH service
I think this has probably been asked, but after reading a lot, I'm not
I think my question revolves around me not having a comfortable grasp of page
I think under windows x64, it still uses user32.dll and a bunch of other
I think I have a fairly basic question here. I'm not trying to waste

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.