From: Christian Kerth Date: 2007-11-16T19:23:11+09:00 Subject: ActiveRecord Problem Hey! ich habe folgende tabellen in meiner sqlite datenbank: users ([pk] id, username...) courses ([pk] id, coursename...) users_courses ([pk] users_id, [pk] courses_id, score) ich m旦chte die n:m beziehung zwischen users und courses 端ber useres_course modellieren. Dazu hab ich 3 Models angelegt: class User < ActiveRecord::Base has_many :users_courses has_many :courses, :through => :users_courses end class Course < ActiveRecord::Base #set_table_name 'courses' has_many :users_courses has_many :users, :through => :users_courses end class UserCourse < ActiveRecord::Base belongs_to :courses belongs_to :users end Ein find z.B. 端ber das User Model funktioniert einwandfrei. Frage ich aber z.B. sowas wie das hier ab: u = User.find(:first, :conditions => [ "username = ?", session["user"]]) usercourses = u.users_courses.collect{|x| x.courses} bekomm ich den Fehler: uninitialized constant User::UsersCourse hat jemand eine Idee? -- Posted via http://www.ruby-forum.com/.