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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:20:09+00:00 2026-05-17T18:20:09+00:00

I have three classes with the following associations: class Technician < ActiveRecord::Base has_many :tickets

  • 0

I have three classes with the following associations:

class Technician < ActiveRecord::Base  
  has_many :tickets
  has_many :services, :through => :tickets  
end

class Ticket < ActiveRecord::Base
  belongs_to :technician
  has_many :services
end

class Service < ActiveRecord::Base
  belongs_to :ticket
  belongs_to :technicians
end

When I try to use the associations in IRB I get the error messages below:

tech = Technician.first
ticket1 = Ticket.new
tech.ticket1

NoMethodError: undefined method `t1' for #<Technician:0xa0d6d6c>
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:364:in `method_missing'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/attribute_methods.rb:46:in `method_missing'
from (irb):7
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands/console.rb:44:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands/console.rb:8:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Am I mission or doing something 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-17T18:20:10+00:00Added an answer on May 17, 2026 at 6:20 pm

    Yep, you’re doing something wrong. You should read this first: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html

    In this particular case, you probably wanted to do something like this:

    tech = Technician.first
    tech.tickets << Ticket.new
    tech.tickets.last
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have three classes: class X{}; class Y{}; class Both : public X,
Let's say I have a Base class and several Derived classes. Is there any
Let's say I have following classes. (only most important things included) public class Client
I have the following 3 classes in my dbml file: public class Player {
Let's say I have the following two classes: public class Person { public string
I have following two classes: template <size_t size> class Cont{ public: char charArray[size]; };
I have the following 3 classes Book Product SpecialOptions There are many Books, and
Suppose I have three classes. It is valid to instantiate A, but there are
If I have three classes, A, B, C. A and B are friends (bidirectionally).
I have three (C++) classes: Player, Hand, and Card. Player has a member, hand,

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.