I''ve got a pretty crazy has_many :through going. My join table is set up like this: # Table name: memberships # # id :integer not null, primary key # member_of_id :integer # member_of_type :string(255) # user_id :integer And in my User model, I''ve got: class User < ActiveRecord::Base has_many :memberships has_many :terms, :through => :memberships, :source => :term, :conditions => "memberships.member_of_type = ''Term''" def add_term(term) unless terms.exists? ["memberships.member_of_type = ? AND memberships.member_of_id = ?", "Term", term] terms << term #Line 50 end return true end end Any time I call terms << term (in this method or in the console or whatever) I''m getting: NoMethodError (You have a nil object when you didn''t expect it! The error occurred while evaluating nil.constantize): (eval):7:in `before_save'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:301:in `send'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:301:in `callback'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:206:in `create_or_update'' /vendor/rails/activerecord/lib/active_record/base.rb:2151:in `save_without_validation!'' /vendor/rails/activerecord/lib/active_record/validations.rb:927:in `save_without_dirty!'' /vendor/rails/activerecord/lib/active_record/dirty.rb:82:in `save_without_transactions!'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 110:in `save!'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/database_statements.rb:66:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb:79:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb:98:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 110:in `save!'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 118:in `rollback_active_record_state!'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 110:in `save!'' /vendor/rails/activerecord/lib/active_record/validations.rb:898:in `create!'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:60:in `<<'' /vendor/rails/activerecord/lib/active_record/base.rb:1801:in `with_scope'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:60:in `send'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:60:in `<<'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:56:in `each'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:56:in `<<'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/database_statements.rb:66:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb:79:in `transaction'' /vendor/rails/activerecord/lib/active_record/associations/ has_many_through_association.rb:55:in `<<'' /app/models/user.rb:50:in `add_term'' Anyone have any idea''s? I''m running edge rails from last week. Thanks, BJ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---