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?