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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:15:43+00:00 2026-06-18T16:15:43+00:00

I created an association between customer_bill and customer_bill_line_item as follows: class CustomerBill < ActiveRecord::Base

  • 0

I created an association between customer_bill and customer_bill_line_item as follows:

class CustomerBill < ActiveRecord::Base
  attr_accessible :customer_bill_line_items_attributes
  has_many :customer_bill_line_items, :dependent =>:destroy

  accepts_nested_attributes_for :customer_bill_line_items, :allow_destroy => true
end

class CustomerBillLineItem < ActiveRecord::Base
  attr_accessible :customer_bill_id 
  belongs_to :customer_bill, :foreign_key => "customer_bill_id"
end

When I enter a form in create mode, I get the following error:

uninitialized constant CustomerBill::CustomerBillLineItem

Extracted source (around line #66):

63:                             <%end%>
64:                            
65:                            
66:             <%= f.fields_for :customer_bill_line_items do |builder| %>
67:             <%= render 'customer_bill_line_item_fields', :f => builder %>
68:             <%end%>

The full stack trace is given in the comment.

Is there an association that must be made in customer_bills_controller like@customer_bill.customer_bill_line_items??

Guidance required. Thanks in advance.

  • 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-18T16:15:44+00:00Added an answer on June 18, 2026 at 4:15 pm

    I quickly threw an example app together to prove what you were doing was right, you can check it out here: https://github.com/Bram–/customer_bill which works fine.
    Just make sure before you spin it up you have a Customer Bill & CustomerBillLineItems:

    c = CustomerBill.create name: 'Name'
    CustomerBillLineItem.create name: 'Line Item A', price: '1.00', customer_bill_id: c.id
    CustomerBillLineItem.create name: 'Line Item B', price: '2.00', customer_bill_id: c.id
    

    What versions are you using, is there anything else we’re not seeing in the above code?

    Hope the example helps, otherwise drop me a line.

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

Sidebar

Related Questions

The following are the models and association. class Vendor < ActiveRecord::Base attr_accessible :name, :address_attributes
What I have now: class User < ActiveRecord::Base has_many :people end ... and... class
I have got the following models, class City < ActiveRecord::Base belongs_to :state belongs_to :country
I have a has_many and belongs_to association set up between two models: Project and
I have two models, subject and page . I created a one-to-many association between
I am new to rails and ruby. I have a has_many association between user
I've created a one-to-one association between my Admin and Report models and it isn't
Following is from Effective Java: The association between a nonstatic member class instance and
I have a has_many through association setup between a song model and an artist
I have setup a has_many through association between two models in Ruby on Rails.

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.