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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:27:23+00:00 2026-05-26T06:27:23+00:00

I have a weird bug that just popped up with my rails app that

  • 0

I have a weird bug that just popped up with my rails app that I cannot figure out. I recently added a new association to an existing Model and now my previous associations do not want to work properly.

#=> self.user
#=> <# user.id => "1" ...
#=> self.transactions
#=> [<# transaction_id => "1"...
#=> self.credit_plan
#=> nil

So the first two associations work fine via, but for some reason credit_plan returns nil and is crashing all my existing working code. Here is the record associations I have.

class Order < ActiveRecord::Base
  belongs_to :user
  belongs_to :credit_plan
  has_many :transactions, :class_name => "OrderTransaction"

.

class CreditPlan < ActiveRecord::Base
  scope :active, where({:is_active => true})
  scope :inactive, where({:is_active => false})
  has_many :orders, :class_name => "Order"

.

class OrderTransaction < ActiveRecord::Base
  belongs_to :order
  serialize :params
  • 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-26T06:27:23+00:00Added an answer on May 26, 2026 at 6:27 am

    Alright Guys, I figured it out. If I had posted more context of my files, I’m sure someone would have figured it out and helped me sooner.

    So basically, when I was setting up my virtual attributes for the credit card form, I accidentally stomped on my own name space by adding :credit_plan as an attribute, which overrides the association.

    class Order < ActiveRecord::Base
      belongs_to :user
      belongs_to :credit_plan
      has_many :transactions, :class_name => "OrderTransaction"
    
      validates_presence_of :credit_plan_id, :user
    
      attr_accessor :first_name, :last_name, :card_type, :credit_card,
                :number, :verification_value, :promotional_code, :expires_on,
                :credit_plan # << This will override associations, delete to fix. 
    
      validate :validate_card, :on => :create
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very weird bug that I can't seem to figure out. I
This is a weird bug that I can't figure out because I have tested
I have this weird bug that I cannot fix. Can anyone help me? Thank
I have a weird bug that is present only in IE (7/8/9/9CV). FF and
I found a weird bug in Rails 3.0.? that I want to report to
I have a weird bug in Chrome which affects a page in Wordpress. I
i'm trying to get started with silverlight 2. i have a weird bug. every
I have this supper weird bug, where this method fails in IE9. What is
I believe I have found a weird bug as follow: I want to delete
I have a weird problem with a Java Gregorian Calendar: SimpleDateFormat sdf = new

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.