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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:37:57+00:00 2026-06-17T21:37:57+00:00

I have an app with three models: Client has_many :papers Paper has_many :pages belongs_to

  • 0

I have an app with three models:

Client

has_many :papers

Paper

has_many :pages
belongs_to :client

Page

belongs_to :paper

I can do this in code: @paper.client.name

But I am unable to do @paper.page.name NoMethodError is produced

What I am doing wrong? These are all nested models, where Client is at high level.

  • 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-17T21:37:58+00:00Added an answer on June 17, 2026 at 9:37 pm

    Your Paper object has many pages, so there’s no page method. If you want to get the names of all the pages belonging to a Paper object, you’ll need to iterate over the pages association:

    for page in @paper.pages
        puts page.name
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following: app/models/order.rb class Order < ActiveRecord::Base belongs_to :client accepts_nested_attributes_for :client end
I have developed three different versions(as different projects) of an app(large,normal,small). How can I
in a django-tastypie app I have the following Django-models: class Car(models.Model): name=models.CharField('name',max_length=64) class CarTrack(models.Model):
I've got an app with three spinners, they have unique IDs and I'm trying
I have a winforms app. I give it to three clients and each one
I have a service monitor app that monitors the status of three other servers
In a rails 3 app I'm building I have these three classes: class Instrument
I have an Android project that branched into three different applications, app-1 , app-2
In the tablet layout of my app, I have three ListFragments and one regular
I have a very simple MVC app at this point: Controller: public class HomeController

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.