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

  • Home
  • SEARCH
  • 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 8817251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:48:03+00:00 2026-06-14T04:48:03+00:00

I have 3 models that are basically nested. class User < ActiveRecord::Base attr_accessible :birthday,

  • 0

I have 3 models that are basically nested.

class User < ActiveRecord::Base
  attr_accessible :birthday, :name
  has_one :advancement, :dependent => :destroy
  accepts_nested_attributes_for :advancement
  attr_accessible :advancement_attributes
end

class Advancement < ActiveRecord::Base
  attr_accessible :user_id, :rank_name
  belongs_to :user
  has_one :rank, :dependent => :destroy
  accepts_nested_attributes_for :_rank
  attr_accessible :rank_attributes
end

class Rank < ActiveRecord::Base
  attr_accessible :advancement_id, :one_li, :one_pi, :one_date, ...
  belongs_to :advancement
end

Here is the controller code I use to create my models.

class UsersController < ApplicationController
  def new
    @user = User.new
    @user.advancement = Advancement.new
    @user.advancement.rank = Rank.new

    respond_to do |format|
      format.html # new.html.erb
    end
  end

  def create
    @user = User.new(params[:user])
    @user.advancement = Advancement.new
    @user.advancement.rank = Rank.new

    respond_to do |format|
      if @user.save
        format.html { redirect_to @user, notice: 'User was successfully created.' }
      else
        format.html { render action: "new" }
      end
    end
  end
end

In the console I can create relations that work like I would expect. When I try to do this through the browser all of my objects are instantiated, the foreign keys are correct, but if I try to find user.advancement, I get a method missing error. Am I using new or create wrong and if so what should I do? Sorry about the amount of code, but I didnt know any other way to explain it.

  • 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-14T04:48:04+00:00Added an answer on June 14, 2026 at 4:48 am

    To start, in most of your code you reference a “rank” model but the model itself appears to be called “BoyScoutRank”. Could this be the issue?

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

Sidebar

Related Questions

I have three models that look something like this: class Bucket < ActiveRecord::Base has_many
Say I have a three models that look (basically) like this: class User <
I have 2 models: class Video < ActiveRecord::Base belongs_to :categories, :foreign_key => category, :class_name
I have two models that are associated with each other. Customer has_one :primary_contact And
Let's say I have a class structure that is defined below: Class Item(models.Model): ...
I have some Django models with a structure similar to this: class Grandparent(models.Model): name
I have a couple of models that are composites of multiple objects. I basically
Basically I have two models: User and Godfather. The godfather table has three columns:
I am working on a project where we have data models that look basically
I have a POCO class, mapping to a table that basically contain three primary

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.