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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:58:02+00:00 2026-05-20T17:58:02+00:00

These are my models: class Company < ActiveRecord::Base has_many :products end class Product <

  • 0

These are my models:

class Company < ActiveRecord::Base  
  has_many :products  
end

class Product < ActiveRecord::Base  
  belongs_to :company  
  has_many :prices  
end

class Price < ActiveRecord::Base  
  belongs_to :product  
end

I defined them in routes as nested resources

resources :companies  
namespace :company do  
  scope ":company_id" do  
    resources :products do  
      resources :prices  
      resources :production_capabilities  
    end  
  end  
end

I wanted to put controllers and views in catalogs matching that structure

app/controllers/companies_controller.rb  
app/controllers/company/products_controller.rb  
app/controllers/company/product  
app/controllers/company/product/prices_controller.rb

As soon as i create product directory inside company and i try to call

Company.find(1).products

i get

NoMethodError: undefined method 'quoted_table_name' for Company::Product:Module

Does anybody know what am i doing wrong?

  • 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-20T17:58:03+00:00Added an answer on May 20, 2026 at 5:58 pm

    The Rails documentation explicitly recommends that we don’t nest resources more than 1 level deep:

    http://guides.rubyonrails.org/routing.html#nested-resources

    You’ll get URLs like this:

    /company/1/product/4/price/5
    

    That’s not pretty. Try to avoid it.

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

Sidebar

Related Questions

I have the following two models class ContactField < ActiveRecord::Base end class Address <
Postgresql / Rails 3 / Ruby 1.9.2 / OSX class Deliverable < ActiveRecord::Base has_many
excuse me for my ugly english) ! Imagine these very simple models : class
Say I have the following in my models.py : class Company(models.Model): name = ...
I have the following model: class CompanyReport(models.Model): company = models.CharField(max_length=300) desc = models.TextField() text
In my models.py, I user these code to extent two fields: User.add_to_class('bio', models.TextField(blank=True)) User.add_to_class('about',
class Foo(models.Model): title = models.CharField(max_length=20) slug = models.SlugField() Is there a built-in way to
The situation is as follows: I've got 2 models: 'Action' and 'User'. These models
I'm kind of torn between these two error-handling models: Create a boolean Error and
I have some models; Vocabularies (tags lists), Labels (tags) and different articles types. These

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.